Skip to content

Commit 25087df

Browse files
author
Vitaliy Guliy
committed
Fixing tests
1 parent f7f22e2 commit 25087df

2 files changed

Lines changed: 16 additions & 14 deletions

File tree

ide/che-core-ide-app/src/test/java/org/eclipse/che/ide/actions/LinkWithEditorActionTest.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import com.google.web.bindery.event.shared.EventBus;
1717

1818
import org.eclipse.che.ide.CoreLocalizationConstant;
19+
import org.eclipse.che.ide.api.action.ActionEvent;
20+
import org.eclipse.che.ide.api.action.Presentation;
1921
import org.eclipse.che.ide.api.editor.EditorAgent;
2022
import org.eclipse.che.ide.api.editor.EditorInput;
2123
import org.eclipse.che.ide.api.editor.EditorPartPresenter;
@@ -75,7 +77,7 @@ public void setUp() throws Exception {
7577
public void actionShouldBePerformed() throws Exception {
7678
when(preferencesManager.getValue(eq(LINK_WITH_EDITOR))).thenReturn(null);
7779

78-
action.actionPerformed(null);
80+
action.actionPerformed(new ActionEvent(new Presentation(), null, null));
7981

8082
verify(preferencesManager).setValue("linkWithEditor", Boolean.toString(true));
8183
verify(eventBus).fireEvent((Event<?>)anyObject());
@@ -86,7 +88,7 @@ public void actionShouldNotBePerformedIfActiveEditorIsNull() throws Exception {
8688
when(preferencesManager.getValue(eq(LINK_WITH_EDITOR))).thenReturn(null);
8789
when(editorAgent.getActiveEditor()).thenReturn(null);
8890

89-
action.actionPerformed(null);
91+
action.actionPerformed(new ActionEvent(new Presentation(), null, null));
9092

9193
verify(eventBus, never()).fireEvent((Event<?>)anyObject());
9294
}
@@ -96,7 +98,7 @@ public void actionShouldNotBePerformedIfEditorInputIsNull() throws Exception {
9698
when(preferencesManager.getValue(eq(LINK_WITH_EDITOR))).thenReturn(null);
9799
when(editorPartPresenter.getEditorInput()).thenReturn(null);
98100

99-
action.actionPerformed(null);
101+
action.actionPerformed(new ActionEvent(new Presentation(), null, null));
100102

101103
verify(eventBus, never()).fireEvent((Event<?>)anyObject());
102104
}
@@ -105,7 +107,7 @@ public void actionShouldNotBePerformedIfEditorInputIsNull() throws Exception {
105107
public void revealEventShouldNotBeFiredIfPreferenceValueIsFalse() throws Exception {
106108
when(preferencesManager.getValue(eq(LINK_WITH_EDITOR))).thenReturn(Boolean.toString(true));
107109

108-
action.actionPerformed(null);
110+
action.actionPerformed(new ActionEvent(new Presentation(), null, null));
109111

110112
verify(eventBus, never()).fireEvent((Event<?>)anyObject());
111113
}
@@ -114,7 +116,7 @@ public void revealEventShouldNotBeFiredIfPreferenceValueIsFalse() throws Excepti
114116
public void revealEventShouldBeFiredIfPreferenceValueIsTrue() throws Exception {
115117
when(preferencesManager.getValue(eq(LINK_WITH_EDITOR))).thenReturn(Boolean.toString(false));
116118

117-
action.actionPerformed(null);
119+
action.actionPerformed(new ActionEvent(new Presentation(), null, null));
118120

119121
verify(eventBus).fireEvent((Event<?>)anyObject());
120122
}

ide/che-core-ide-app/src/test/java/org/eclipse/che/ide/part/editor/multipart/EditorMultiPartStackPresenterTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public class EditorMultiPartStackPresenterTest {
5454
@Mock
5555
private EventBus eventBus;
5656
@Mock
57-
private Provider<EditorPartStack> editorPartStackFactory;
57+
private Provider<EditorPartStack> editorPartStackProvider;
5858

5959
//additional mocks
6060
@Mock
@@ -72,11 +72,11 @@ public class EditorMultiPartStackPresenterTest {
7272

7373
@Before
7474
public void setUp() {
75-
when(editorPartStackFactory.get()).thenReturn(editorPartStack);
75+
when(editorPartStackProvider.get()).thenReturn(editorPartStack);
7676
when(editorPartStack.containsPart(partPresenter1)).thenReturn(true);
7777
when(eventBus.addHandler((Event.Type<Object>)anyObject(), anyObject())).thenReturn(handlerRegistration);
7878

79-
presenter = new EditorMultiPartStackPresenter(eventBus, view, editorPartStackFactory);
79+
presenter = new EditorMultiPartStackPresenter(eventBus, view, editorPartStackProvider);
8080
}
8181

8282
@Test
@@ -88,7 +88,7 @@ public void constructorShouldBeVerified() {
8888
public void shouldOpenPartInNewEditorPartStack() {
8989
presenter.addPart(partPresenter1, null);
9090

91-
verify(editorPartStackFactory).get();
91+
verify(editorPartStackProvider).get();
9292
verify(editorPartStack).addPart(partPresenter1);
9393
verify(view).addPartStack(eq(editorPartStack), isNull(EditorPartStack.class), isNull(Constraints.class), eq(-1.0));
9494
}
@@ -98,25 +98,25 @@ public void shouldOpenPartInActiveEditorPartStack() {
9898
presenter.addPart(partPresenter1);
9999
presenter.setActivePart(partPresenter1);
100100
reset(view);
101-
reset(editorPartStackFactory);
101+
reset(editorPartStackProvider);
102102

103103
presenter.addPart(partPresenter2, null);
104104

105-
verify(editorPartStackFactory, never()).get();
105+
verify(editorPartStackProvider, never()).get();
106106
verify(editorPartStack).addPart(partPresenter2);
107107
verify(view, never()).addPartStack((EditorPartStack)anyObject(), (EditorPartStack)anyObject(), (Constraints)anyObject(), eq(-1.0));
108108
}
109109

110110
@Test
111111
public void shouldSplitEditorPartStackAndOpenPart() {
112112
presenter.addPart(partPresenter1);
113-
reset(editorPartStackFactory);
114-
when(editorPartStackFactory.get()).thenReturn(editorPartStack);
113+
reset(editorPartStackProvider);
114+
when(editorPartStackProvider.get()).thenReturn(editorPartStack);
115115
when(editorPartStack.getPartByTabId(RELATIVE_PART_ID)).thenReturn(partPresenter1);
116116

117117
presenter.addPart(partPresenter2, constraints);
118118

119-
verify(editorPartStackFactory).get();
119+
verify(editorPartStackProvider).get();
120120
verify(editorPartStack).addPart(partPresenter2);
121121
verify(view).addPartStack(editorPartStack, editorPartStack, constraints, -1);
122122
}

0 commit comments

Comments
 (0)