Skip to content

Commit ca02a1a

Browse files
committed
refact: cleanup junit test configuration
1 parent 901e2ed commit ca02a1a

11 files changed

Lines changed: 31 additions & 30 deletions

File tree

org.eclipse.tm4e.core.tests/.classpath

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@
1212
<attribute name="maven.pomderived" value="true"/>
1313
</attributes>
1414
</classpathentry>
15-
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/>
1615
<classpathentry kind="src" output="target/classes" path="src/main/java">
1716
<attributes>
1817
<attribute name="maven.pomderived" value="true"/>
1918
<attribute name="optional" value="true"/>
2019
</attributes>
2120
</classpathentry>
22-
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
21+
<classpathentry kind="src" output="target/classes" path="src/main/resources">
2322
<attributes>
2423
<attribute name="maven.pomderived" value="true"/>
2524
</attributes>

org.eclipse.tm4e.core.tests/META-INF/MANIFEST.MF

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Require-Bundle: org.apache.batik.css;resolution:=optional,
1010
com.google.gson;resolution:=optional,
1111
org.eclipse.core.runtime,
1212
org.eclipse.tm4e.core
13-
Import-Package: org.junit.runner,
14-
org.junit.jupiter.api,org.junit.jupiter.api.function,
13+
Import-Package: org.junit.jupiter.api,
14+
org.junit.jupiter.api.function,
1515
org.w3c.css.sac;resolution:=optional,
1616
org.w3c.css.sac.helpers;resolution:=optional
1717
Bundle-RequiredExecutionEnvironment: JavaSE-17

org.eclipse.tm4e.languageconfiguration.tests/.classpath

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<classpath>
33
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
44
<attributes>
5+
<attribute name="module" value="true"/>
56
<attribute name="maven.pomderived" value="true"/>
67
</attributes>
78
</classpathentry>
@@ -11,7 +12,6 @@
1112
<attribute name="maven.pomderived" value="true"/>
1213
</attributes>
1314
</classpathentry>
14-
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/>
1515
<classpathentry kind="src" output="target/classes" path="src/main/java">
1616
<attributes>
1717
<attribute name="maven.pomderived" value="true"/>

org.eclipse.tm4e.languageconfiguration.tests/META-INF/MANIFEST.MF

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Require-Bundle: org.eclipse.core.runtime,
1616
org.eclipse.ui.workbench,
1717
org.eclipse.ui.workbench.texteditor,
1818
org.eclipse.tm4e.languageconfiguration,
19-
org.eclipse.tm4e.ui,
20-
org.junit
19+
org.eclipse.tm4e.ui
2120
Bundle-ActivationPolicy: lazy
2221
Import-Package: org.junit.jupiter.api

org.eclipse.tm4e.languageconfiguration.tests/src/main/java/org/eclipse/tm4e/languageconfiguration/tests/TestComment.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
*/
99
package org.eclipse.tm4e.languageconfiguration.tests;
1010

11-
import static org.junit.Assert.*;
12-
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
11+
import static org.junit.jupiter.api.Assertions.*;
1312

1413
import java.io.ByteArrayInputStream;
1514

org.eclipse.tm4e.ui.tests/.classpath

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<classpath>
33
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
44
<attributes>
5+
<attribute name="module" value="true"/>
56
<attribute name="maven.pomderived" value="true"/>
67
</attributes>
78
</classpathentry>
@@ -11,14 +12,13 @@
1112
<attribute name="maven.pomderived" value="true"/>
1213
</attributes>
1314
</classpathentry>
14-
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/>
1515
<classpathentry kind="src" output="target/classes" path="src/main/java">
1616
<attributes>
1717
<attribute name="maven.pomderived" value="true"/>
1818
<attribute name="optional" value="true"/>
1919
</attributes>
2020
</classpathentry>
21-
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
21+
<classpathentry kind="src" output="target/classes" path="src/main/resources">
2222
<attributes>
2323
<attribute name="maven.pomderived" value="true"/>
2424
</attributes>

org.eclipse.tm4e.ui.tests/META-INF/MANIFEST.MF

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,15 @@ Require-Bundle: org.eclipse.jface.text,
1111
org.eclipse.core.runtime,
1212
org.eclipse.ui,
1313
org.eclipse.ui.editors,
14-
org.eclipse.ui.genericeditor;resolution:=optional,
14+
org.eclipse.ui.genericeditor,
1515
org.eclipse.ui.ide,
1616
org.eclipse.ui.tests.harness,
1717
org.eclipse.tm4e.core,
1818
org.eclipse.tm4e.registry,
19-
org.eclipse.tm4e.ui,
20-
com.google.gson;bundle-version="[2.10.1,3.0.0)",
21-
org.junit,
22-
junit-jupiter-api,
23-
org.opentest4j
19+
org.eclipse.tm4e.ui
2420
Bundle-RequiredExecutionEnvironment: JavaSE-17
2521
Bundle-ActivationPolicy: lazy
26-
Import-Package: org.eclipse.core.filebuffers
22+
Import-Package: org.junit.jupiter.api,
23+
org.junit.jupiter.api.condition,
24+
org.opentest4j
2725
Automatic-Module-Name: org.eclipse.tm4e.ui.tests

org.eclipse.tm4e.ui.tests/src/main/java/org/eclipse/tm4e/ui/tests/TMPresentationReconcilerTypeScriptTest.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,31 @@
2828
import org.junit.jupiter.api.BeforeEach;
2929
import org.junit.jupiter.api.Disabled;
3030
import org.junit.jupiter.api.Test;
31+
import org.junit.jupiter.api.condition.DisabledIf;
3132

33+
@DisabledIf("org.eclipse.tm4e.ui.tests.TMPresentationReconcilerTypeScriptTest#isDisabled")
3234
class TMPresentationReconcilerTypeScriptTest {
3335

36+
static boolean isDisabled() {
37+
// TODO ignore these tests on GitHub Actions Windows runner because they are extremely slow (4-5min) for an unknown reason
38+
return TestUtils.isGitHubActions() && System.getProperty("os.name").toLowerCase().contains("windows");
39+
}
40+
3441
private IGrammar grammar;
3542
private ITokenProvider theme;
3643
private TMEditor editor;
3744

3845
@BeforeEach
3946
void setup() throws Exception {
40-
// TODO ignore these tests on GitHub Actions Windows runner because they are extremely slow (4-5min) for an unknown reason
41-
org.junit.Assume.assumeFalse(TestUtils.isGitHubActions() && System.getProperty("os.name").toLowerCase().contains("windows"));
42-
4347
TestUtils.assertNoTM4EThreadsRunning();
4448

4549
grammar = new Registry().addGrammar(IGrammarSource.fromResource(getClass(), "/grammars/TypeScript.tmLanguage.json"));
46-
theme = TMUIPlugin.getThemeManager().getThemeById(ThemeIdConstants.SolarizedLight);
50+
theme = TMUIPlugin.getThemeManager().getThemeById(ThemeIdConstants.SolarizedLight);
4751
}
4852

4953
@AfterEach
5054
void tearDown() throws InterruptedException {
51-
if(editor != null)
55+
if (editor != null)
5256
editor.dispose();
5357

5458
TestUtils.assertNoTM4EThreadsRunning();

org.eclipse.tm4e.ui.tests/src/main/java/org/eclipse/tm4e/ui/tests/internal/model/TMDocumentModelTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import org.eclipse.tm4e.core.registry.Registry;
3232
import org.eclipse.tm4e.ui.internal.model.TMDocumentModel;
3333
import org.eclipse.tm4e.ui.tests.support.TestUtils;
34-
import org.junit.function.ThrowingRunnable;
3534
import org.junit.jupiter.api.AfterEach;
3635
import org.junit.jupiter.api.BeforeAll;
3736
import org.junit.jupiter.api.BeforeEach;
@@ -42,6 +41,10 @@
4241
@TestMethodOrder(MethodOrderer.MethodName.class)
4342
class TMDocumentModelTest {
4443

44+
interface ThrowingRunnable {
45+
void run() throws Throwable;
46+
}
47+
4548
private static final String LF = "\n";
4649
private static IGrammar grammar;
4750

org.eclipse.tm4e.ui.tests/src/main/java/org/eclipse/tm4e/ui/tests/internal/utils/DocumentInputStreamTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
package org.eclipse.tm4e.ui.tests.internal.utils;
1313

1414
import static java.nio.charset.StandardCharsets.UTF_8;
15-
import static org.junit.Assert.*;
15+
import static org.junit.jupiter.api.Assertions.*;
1616

1717
import java.io.ByteArrayInputStream;
1818
import java.io.IOException;
@@ -28,8 +28,8 @@
2828
import org.eclipse.ui.editors.text.FileDocumentProvider;
2929
import org.eclipse.ui.part.FileEditorInput;
3030
import org.eclipse.ui.texteditor.IDocumentProvider;
31-
import org.junit.Before;
32-
import org.junit.Test;
31+
import org.junit.jupiter.api.BeforeEach;
32+
import org.junit.jupiter.api.Test;
3333

3434
class DocumentInputStreamTest {
3535

@@ -44,7 +44,7 @@ class DocumentInputStreamTest {
4444
private final IDocumentProvider documentProvider = new FileDocumentProvider();
4545
private IDocument document;
4646

47-
@Before
47+
@BeforeEach
4848
public void setUp() throws CoreException {
4949
final IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(getClass().getName() + System.currentTimeMillis());
5050
p.create(null);

0 commit comments

Comments
 (0)