Skip to content

Commit b235a27

Browse files
committed
Migrate all pde.ds.annotations.tests to JUnit 5 and remove launch config
The launch configuration isn't usable and wasn't working as it was still set to use a 'J2SE-1.8' JRE. Just launching the the desired tests with a new launch configuration from the context menu works very well.
1 parent 92bf2c9 commit b235a27

12 files changed

+50
-90
lines changed

ds/org.eclipse.pde.ds.annotations.tests/All DS Annotations Tests.launch

Lines changed: 0 additions & 41 deletions
This file was deleted.

ds/org.eclipse.pde.ds.annotations.tests/META-INF/MANIFEST.MF

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ Require-Bundle: org.eclipse.pde.ds.annotations;bundle-version="[1.1.0,1.5.0)",
1414
org.eclipse.core.runtime;bundle-version="[3.29.0,4.0.0)",
1515
org.eclipse.text;bundle-version="[3.6.0,4.0.0)"
1616
Export-Package: org.eclipse.pde.ds.internal.annotations.tests;x-internal:=true
17-
Import-Package: org.junit,
18-
org.junit.runner,
19-
org.junit.runners
17+
Import-Package: org.junit.jupiter.api;version="[5.14.0,6.0.0)",
18+
org.junit.platform.suite.api;version="[1.14.0,2.0.0)"
2019
Eclipse-BundleShape: dir
2120
Bundle-ClassPath: tests.jar
2221
Automatic-Module-Name: org.eclipse.pde.ds.annotations.tests

ds/org.eclipse.pde.ds.annotations.tests/src/org/eclipse/pde/ds/internal/annotations/tests/AllDSAnnotationsTests.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@
2121
import org.eclipse.core.runtime.IStatus;
2222
import org.eclipse.core.runtime.Status;
2323
import org.eclipse.core.runtime.jobs.Job;
24-
import org.junit.AfterClass;
25-
import org.junit.BeforeClass;
26-
import org.junit.runner.RunWith;
27-
import org.junit.runners.Suite;
28-
import org.junit.runners.Suite.SuiteClasses;
24+
import org.junit.jupiter.api.AfterAll;
25+
import org.junit.jupiter.api.BeforeAll;
26+
import org.junit.platform.suite.api.SelectClasses;
27+
import org.junit.platform.suite.api.Suite;
2928
import org.osgi.framework.Bundle;
3029

31-
@RunWith(Suite.class)
32-
@SuiteClasses({
30+
@Suite
31+
@SelectClasses({
3332
ManagedProjectTest.class,
3433
UnmanagedProjectTest.class,
3534
ErrorProjectTest.class,
@@ -48,7 +47,7 @@ public class AllDSAnnotationsTests {
4847

4948
static Job wsJob;
5049

51-
@BeforeClass
50+
@BeforeAll
5251
public static void setUpBeforeClass() throws Exception {
5352
final IWorkspace ws = ResourcesPlugin.getWorkspace();
5453
final Bundle bundle = Activator.getContext().getBundle();
@@ -84,7 +83,7 @@ public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
8483
wsJob.schedule();
8584
}
8685

87-
@AfterClass
86+
@AfterAll
8887
public static void tearDownAfterClass() throws Exception {
8988
wsJob.cancel();
9089
final IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();

ds/org.eclipse.pde.ds.annotations.tests/src/org/eclipse/pde/ds/internal/annotations/tests/AnnotationProcessorTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package org.eclipse.pde.ds.internal.annotations.tests;
22

3-
import static org.junit.Assert.assertNotNull;
4-
import static org.junit.Assert.assertTrue;
53
import static org.junit.Assume.assumeTrue;
4+
import static org.junit.jupiter.api.Assertions.assertNotNull;
5+
import static org.junit.jupiter.api.Assertions.assertTrue;
66

77
import java.io.ByteArrayOutputStream;
88
import java.io.InputStream;
@@ -34,7 +34,7 @@ public void setUp() throws Exception {
3434
assumeTrue("Test project does not exist!", testProject.exists());
3535

3636
IFile dsFile = testProject.getFile(IPath.fromOSString(getComponentDescriptorPath()));
37-
assertTrue("Missing component descriptor!", dsFile.exists());
37+
assertTrue(dsFile.exists(),"Missing component descriptor!");
3838

3939
ByteArrayOutputStream buf = new ByteArrayOutputStream();
4040
try (InputStream src = dsFile.getContents()) {

ds/org.eclipse.pde.ds.annotations.tests/src/org/eclipse/pde/ds/internal/annotations/tests/DefaultComponentTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package org.eclipse.pde.ds.internal.annotations.tests;
22

3-
import static org.junit.Assert.assertEquals;
4-
import static org.junit.Assert.assertFalse;
5-
import static org.junit.Assert.assertNotNull;
6-
import static org.junit.Assert.assertNull;
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
import static org.junit.jupiter.api.Assertions.assertFalse;
5+
import static org.junit.jupiter.api.Assertions.assertNotNull;
6+
import static org.junit.jupiter.api.Assertions.assertNull;
77

88
import java.util.concurrent.Executor;
99

@@ -12,7 +12,7 @@
1212
import org.eclipse.pde.internal.ds.core.IDSProvide;
1313
import org.eclipse.pde.internal.ds.core.IDSReference;
1414
import org.eclipse.pde.internal.ds.core.IDSService;
15-
import org.junit.Test;
15+
import org.junit.jupiter.api.Test;
1616

1717
@SuppressWarnings("restriction")
1818
public class DefaultComponentTest extends AnnotationProcessorTest {

ds/org.eclipse.pde.ds.annotations.tests/src/org/eclipse/pde/ds/internal/annotations/tests/ErrorProjectTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package org.eclipse.pde.ds.internal.annotations.tests;
22

3-
import static org.junit.Assert.assertEquals;
4-
import static org.junit.Assert.assertTrue;
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
import static org.junit.jupiter.api.Assertions.assertTrue;
55

66
import org.eclipse.core.resources.IFile;
77
import org.eclipse.core.resources.IMarker;
88
import org.eclipse.core.resources.IResource;
99
import org.eclipse.core.runtime.IPath;
10-
import org.junit.Test;
10+
import org.junit.jupiter.api.Test;
1111

1212
public class ErrorProjectTest extends CompilationParticipantTest {
1313

ds/org.eclipse.pde.ds.annotations.tests/src/org/eclipse/pde/ds/internal/annotations/tests/ExtendedLifeCycleMethodComponentTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package org.eclipse.pde.ds.internal.annotations.tests;
22

3-
import static org.junit.Assert.assertEquals;
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
44

5-
import org.junit.Test;
5+
import org.junit.jupiter.api.Test;
66

77
@SuppressWarnings("restriction")
88
public class ExtendedLifeCycleMethodComponentTest extends AnnotationProcessorTest {

ds/org.eclipse.pde.ds.annotations.tests/src/org/eclipse/pde/ds/internal/annotations/tests/ExtendedReferenceMethodComponentTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package org.eclipse.pde.ds.internal.annotations.tests;
22

3-
import static org.junit.Assert.assertEquals;
4-
import static org.junit.Assert.assertNotNull;
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
import static org.junit.jupiter.api.Assertions.assertNotNull;
55

66
import java.util.concurrent.Executor;
77

88
import org.eclipse.pde.internal.ds.core.IDSReference;
9-
import org.junit.Test;
9+
import org.junit.jupiter.api.Test;
1010

1111
@SuppressWarnings("restriction")
1212
public class ExtendedReferenceMethodComponentTest extends AnnotationProcessorTest {

ds/org.eclipse.pde.ds.annotations.tests/src/org/eclipse/pde/ds/internal/annotations/tests/FullComponentTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package org.eclipse.pde.ds.internal.annotations.tests;
22

3-
import static org.junit.Assert.assertEquals;
4-
import static org.junit.Assert.assertFalse;
5-
import static org.junit.Assert.assertNotNull;
6-
import static org.junit.Assert.assertNull;
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
import static org.junit.jupiter.api.Assertions.assertFalse;
5+
import static org.junit.jupiter.api.Assertions.assertNotNull;
6+
import static org.junit.jupiter.api.Assertions.assertNull;
77
import static org.junit.Assume.assumeNotNull;
88
import static org.junit.Assume.assumeTrue;
99

@@ -17,7 +17,7 @@
1717
import org.eclipse.pde.internal.ds.core.IDSProvide;
1818
import org.eclipse.pde.internal.ds.core.IDSReference;
1919
import org.eclipse.pde.internal.ds.core.IDSService;
20-
import org.junit.Test;
20+
import org.junit.jupiter.api.Test;
2121

2222
@SuppressWarnings("restriction")
2323
public class FullComponentTest extends AnnotationProcessorTest {

ds/org.eclipse.pde.ds.annotations.tests/src/org/eclipse/pde/ds/internal/annotations/tests/FullComponentTestV1_2.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package org.eclipse.pde.ds.internal.annotations.tests;
22

3-
import static org.junit.Assert.assertEquals;
4-
import static org.junit.Assert.assertFalse;
5-
import static org.junit.Assert.assertNotNull;
6-
import static org.junit.Assert.assertNull;
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
import static org.junit.jupiter.api.Assertions.assertFalse;
5+
import static org.junit.jupiter.api.Assertions.assertNotNull;
6+
import static org.junit.jupiter.api.Assertions.assertNull;
77
import static org.junit.Assume.assumeNotNull;
88
import static org.junit.Assume.assumeTrue;
99

@@ -17,7 +17,7 @@
1717
import org.eclipse.pde.internal.ds.core.IDSProvide;
1818
import org.eclipse.pde.internal.ds.core.IDSReference;
1919
import org.eclipse.pde.internal.ds.core.IDSService;
20-
import org.junit.Test;
20+
import org.junit.jupiter.api.Test;
2121

2222
@SuppressWarnings("restriction")
2323
public class FullComponentTestV1_2 extends AnnotationProcessorTest {

0 commit comments

Comments
 (0)