Skip to content

Commit c455022

Browse files
HeikoKlareakurtakov
authored andcommitted
Migrate org.eclipse.e4.emf.xpath.tests to JUnit 5
- Exchange annotations including test suites - Exchange assertions
1 parent f001fa3 commit c455022

File tree

5 files changed

+31
-29
lines changed

5 files changed

+31
-29
lines changed

tests/org.eclipse.e4.emf.xpath.test/E4 EMF Xpath Test Suite.launch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
2424
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
2525
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
26-
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
26+
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit5"/>
2727
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
28-
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
28+
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
2929
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.e4.emf.xpath.test.EMFTestSuite"/>
3030
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.e4.emf.xpath.test"/>
3131
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>

tests/org.eclipse.e4.emf.xpath.test/META-INF/MANIFEST.MF

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ Bundle-RequiredExecutionEnvironment: JavaSE-17
99
Export-Package: org.eclipse.e4.emf.xpath.test.model.xpathtest,
1010
org.eclipse.e4.emf.xpath.test.model.xpathtest.impl,
1111
org.eclipse.e4.emf.xpath.test.model.xpathtest.util
12-
Import-Package: org.assertj.core.api;version="[3.27.0,4.0.0)"
12+
Import-Package: org.assertj.core.api;version="[3.27.0,4.0.0)",
13+
org.junit.jupiter.api,
14+
org.junit.jupiter.api.function,
15+
org.junit.platform.suite.api
1316
Require-Bundle: org.eclipse.e4.ui.model.workbench,
1417
org.eclipse.e4.emf.xpath,
15-
org.junit,
1618
org.eclipse.emf.ecore.xmi,
1719
org.eclipse.core.runtime,
1820
org.eclipse.emf.ecore,

tests/org.eclipse.e4.emf.xpath.test/src/org/eclipse/e4/emf/xpath/test/EMFTestSuite.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414

1515
package org.eclipse.e4.emf.xpath.test;
1616

17-
import org.junit.runner.RunWith;
18-
import org.junit.runners.Suite;
19-
import org.junit.runners.Suite.SuiteClasses;
17+
import org.junit.platform.suite.api.SelectClasses;
18+
import org.junit.platform.suite.api.Suite;
2019

21-
@RunWith(Suite.class)
22-
@SuiteClasses({
23-
ExampleQueriesTestCase.class,
24-
ExampleQueriesApplicationTest.class })
20+
@Suite
21+
@SelectClasses({ //
22+
ExampleQueriesTestCase.class, //
23+
ExampleQueriesApplicationTest.class, //
24+
})
2525
public class EMFTestSuite {
2626

2727
}

tests/org.eclipse.e4.emf.xpath.test/src/org/eclipse/e4/emf/xpath/test/ExampleQueriesApplicationTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
package org.eclipse.e4.emf.xpath.test;
1515

1616
import static org.assertj.core.api.Assertions.assertThat;
17-
import static org.junit.Assert.assertEquals;
18-
import static org.junit.Assert.assertNotNull;
17+
import static org.junit.jupiter.api.Assertions.assertEquals;
18+
import static org.junit.jupiter.api.Assertions.assertNotNull;
1919

2020
import java.util.List;
2121

@@ -38,9 +38,9 @@
3838
import org.eclipse.emf.ecore.resource.Resource;
3939
import org.eclipse.emf.ecore.resource.ResourceSet;
4040
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
41-
import org.junit.After;
42-
import org.junit.Before;
43-
import org.junit.Test;
41+
import org.junit.jupiter.api.AfterEach;
42+
import org.junit.jupiter.api.BeforeEach;
43+
import org.junit.jupiter.api.Test;
4444

4545
@SuppressWarnings({ "deprecation", "removal" })
4646
public class ExampleQueriesApplicationTest {
@@ -52,7 +52,7 @@ public class ExampleQueriesApplicationTest {
5252
private Resource childResource;
5353

5454
@SuppressWarnings("restriction")
55-
@Before
55+
@BeforeEach
5656
public void setUp() {
5757
resourceSet = new ResourceSetImpl();
5858
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
@@ -76,7 +76,7 @@ public void setUp() {
7676
xpathChildContext = f.newContext(childResource.getContents().get(0));
7777
}
7878

79-
@After
79+
@AfterEach
8080
public void tearDown() {
8181
xpathContext = null;
8282
resource.unload();

tests/org.eclipse.e4.emf.xpath.test/src/org/eclipse/e4/emf/xpath/test/ExampleQueriesTestCase.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
package org.eclipse.e4.emf.xpath.test;
1616

1717
import static org.assertj.core.api.Assertions.assertThat;
18-
import static org.junit.Assert.assertEquals;
19-
import static org.junit.Assert.assertFalse;
20-
import static org.junit.Assert.assertNotNull;
21-
import static org.junit.Assert.assertSame;
22-
import static org.junit.Assert.assertThrows;
23-
import static org.junit.Assert.assertTrue;
18+
import static org.junit.jupiter.api.Assertions.assertEquals;
19+
import static org.junit.jupiter.api.Assertions.assertFalse;
20+
import static org.junit.jupiter.api.Assertions.assertNotNull;
21+
import static org.junit.jupiter.api.Assertions.assertSame;
22+
import static org.junit.jupiter.api.Assertions.assertThrows;
23+
import static org.junit.jupiter.api.Assertions.assertTrue;
2424

2525
import java.util.Iterator;
2626
import java.util.List;
@@ -39,9 +39,9 @@
3939
import org.eclipse.emf.ecore.resource.ResourceSet;
4040
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
4141
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
42-
import org.junit.After;
43-
import org.junit.Before;
44-
import org.junit.Test;
42+
import org.junit.jupiter.api.AfterEach;
43+
import org.junit.jupiter.api.BeforeEach;
44+
import org.junit.jupiter.api.Test;
4545

4646
@SuppressWarnings({ "deprecation", "removal" })
4747
public class ExampleQueriesTestCase {
@@ -51,7 +51,7 @@ public class ExampleQueriesTestCase {
5151
private Resource resource;
5252
private XPathContextFactory<EObject> xpathContextFactory;
5353

54-
@Before
54+
@BeforeEach
5555
public void setUp() {
5656
resourceSet = new ResourceSetImpl();
5757
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
@@ -65,7 +65,7 @@ public void setUp() {
6565
xpathContext = xpathContextFactory.newContext(resource.getContents().get(0));
6666
}
6767

68-
@After
68+
@AfterEach
6969
public void tearDown() {
7070
xpathContext = null;
7171
xpathContextFactory = null;

0 commit comments

Comments
 (0)