Skip to content

Commit 4cfef08

Browse files
vogellaakurtakov
authored andcommitted
Migrate org.eclipse.ui.tests.internal to JUnit5
1 parent 2e1ed21 commit 4cfef08

2 files changed

Lines changed: 27 additions & 37 deletions

File tree

tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/FileEditorMappingTest.java

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
*******************************************************************************/
1414
package org.eclipse.ui.tests.internal;
1515

16-
import static org.junit.Assert.assertEquals;
17-
import static org.junit.Assert.assertFalse;
16+
import static org.junit.jupiter.api.Assertions.assertEquals;
17+
import static org.junit.jupiter.api.Assertions.assertFalse;
1818

1919
import java.util.ArrayList;
2020
import java.util.List;
@@ -23,22 +23,20 @@
2323
import org.eclipse.ui.ide.IDE;
2424
import org.eclipse.ui.internal.registry.EditorDescriptor;
2525
import org.eclipse.ui.internal.registry.FileEditorMapping;
26-
import org.eclipse.ui.tests.harness.util.CloseTestWindowsRule;
27-
import org.junit.Before;
28-
import org.junit.Ignore;
29-
import org.junit.Rule;
30-
import org.junit.Test;
31-
32-
@Ignore
26+
import org.eclipse.ui.tests.harness.util.CloseTestWindowsExtension;
27+
import org.junit.jupiter.api.BeforeEach;
28+
import org.junit.jupiter.api.Disabled;
29+
import org.junit.jupiter.api.Test;
30+
import org.junit.jupiter.api.extension.ExtendWith;
31+
32+
@Disabled
33+
@ExtendWith(CloseTestWindowsExtension.class)
3334
public class FileEditorMappingTest {
3435

35-
@Rule
36-
public final CloseTestWindowsRule closeTestWindowsRule = new CloseTestWindowsRule();
37-
3836
private EditorDescriptor textEditor;
3937
private EditorDescriptor pdeEditor;
4038

41-
@Before
39+
@BeforeEach
4240
public final void setUp() throws Exception {
4341
textEditor = (EditorDescriptor) IDE.getEditorDescriptor("test.txt");
4442
pdeEditor = (EditorDescriptor) IDE.getEditorDescriptor("plugin.xml");
@@ -53,8 +51,7 @@ public void testEquals() {
5351
assertEquals(textEditor, mappingA.getEditors()[0]);
5452

5553
FileEditorMapping mappingB = new FileEditorMapping("txt");
56-
assertFalse("No editor set for B, should not be equal", mappingA
57-
.equals(mappingB));
54+
assertFalse(mappingA.equals(mappingB), "No editor set for B, should not be equal");
5855

5956
mappingA.addEditor(pdeEditor);
6057
mappingB.addEditor(textEditor);
@@ -70,8 +67,7 @@ public void testEquals() {
7067

7168
assertEquals(textEditor, mappingA.getDefaultEditor());
7269
assertEquals(pdeEditor, mappingB.getDefaultEditor());
73-
assertFalse("Identical except the default editor, should not be equal",
74-
mappingA.equals(mappingB));
70+
assertFalse(mappingA.equals(mappingB), "Identical except the default editor, should not be equal");
7571
}
7672

7773
@Test
@@ -97,8 +93,7 @@ public void testEquals2() {
9793
mappingA.setDefaultEditors(defaultA);
9894
mappingB.setDefaultEditors(defaultB);
9995

100-
assertFalse("Identical except the default editor, should not be equal",
101-
mappingA.equals(mappingB));
96+
assertFalse(mappingA.equals(mappingB), "Identical except the default editor, should not be equal");
10297
}
10398

10499
@Test
@@ -110,8 +105,7 @@ public void testHashCode() {
110105
assertEquals(textEditor, mappingA.getEditors()[0]);
111106

112107
FileEditorMapping mappingB = new FileEditorMapping("txt");
113-
assertFalse("No editor set for B, should not be equal", mappingA
114-
.hashCode() == mappingB.hashCode());
108+
assertFalse(mappingA.hashCode() == mappingB.hashCode(), "No editor set for B, should not be equal");
115109

116110
mappingA.addEditor(pdeEditor);
117111
mappingB.addEditor(textEditor);
@@ -127,8 +121,7 @@ public void testHashCode() {
127121

128122
assertEquals(textEditor, mappingA.getDefaultEditor());
129123
assertEquals(pdeEditor, mappingB.getDefaultEditor());
130-
assertFalse("Identical except the default editor, should not be equal",
131-
mappingA.hashCode() == mappingB.hashCode());
124+
assertFalse(mappingA.hashCode() == mappingB.hashCode(), "Identical except the default editor, should not be equal");
132125
}
133126

134127
@Test
@@ -154,8 +147,7 @@ public void testHashCode2() {
154147
mappingA.setDefaultEditors(defaultA);
155148
mappingB.setDefaultEditors(defaultB);
156149

157-
assertFalse("Identical except the default editor, should not be equal",
158-
mappingA.hashCode() == mappingB.hashCode());
150+
assertFalse(mappingA.hashCode() == mappingB.hashCode(), "Identical except the default editor, should not be equal");
159151
}
160152

161153
@Test

tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/SaveablesListTest.java

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616

1717
import static org.eclipse.ui.SaveablesLifecycleEvent.POST_CLOSE;
1818
import static org.eclipse.ui.SaveablesLifecycleEvent.POST_OPEN;
19-
import static org.junit.Assert.assertEquals;
20-
import static org.junit.Assert.assertNull;
21-
import static org.junit.Assert.assertSame;
22-
import static org.junit.Assert.assertTrue;
19+
import static org.junit.jupiter.api.Assertions.assertEquals;
20+
import static org.junit.jupiter.api.Assertions.assertNull;
21+
import static org.junit.jupiter.api.Assertions.assertSame;
22+
import static org.junit.jupiter.api.Assertions.assertTrue;
2323

2424
import java.util.Arrays;
2525
import java.util.Collection;
@@ -40,19 +40,17 @@
4040
import org.eclipse.ui.Saveable;
4141
import org.eclipse.ui.SaveablesLifecycleEvent;
4242
import org.eclipse.ui.internal.SaveablesList;
43-
import org.eclipse.ui.tests.harness.util.CloseTestWindowsRule;
44-
import org.junit.Before;
45-
import org.junit.Rule;
46-
import org.junit.Test;
43+
import org.eclipse.ui.tests.harness.util.CloseTestWindowsExtension;
44+
import org.junit.jupiter.api.BeforeEach;
45+
import org.junit.jupiter.api.Test;
46+
import org.junit.jupiter.api.extension.ExtendWith;
4747

4848
/**
4949
* @since 3.5
5050
*/
51+
@ExtendWith(CloseTestWindowsExtension.class)
5152
public class SaveablesListTest {
5253

53-
@Rule
54-
public final CloseTestWindowsRule closeTestWindowsRule = new CloseTestWindowsRule();
55-
5654
static class GoodSaveable extends Saveable {
5755

5856
Object source;
@@ -187,7 +185,7 @@ protected Map<Saveable, Integer> getModelRefCounts() {
187185
private DummyPart part2;
188186
private DummyPart part3;
189187

190-
@Before
188+
@BeforeEach
191189
public final void setUp() throws Exception {
192190
slist = new SaveablesListForTest();
193191
source = new Object();

0 commit comments

Comments
 (0)