Skip to content

Commit 60b8674

Browse files
p-O-qakurtakov
authored andcommitted
[E4] Migrate o.e.e4.ui.w.addons.swt.test to JUnit5
Migration of test bundle org.eclipse.e4.ui.workbench.addons.swt.test from JUnit4 to JUnit5.
1 parent c6fbe7d commit 60b8674

File tree

6 files changed

+226
-187
lines changed

6 files changed

+226
-187
lines changed

tests/org.eclipse.e4.ui.workbench.addons.swt.test/META-INF/MANIFEST.MF

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %pluginName
44
Bundle-SymbolicName: org.eclipse.e4.ui.workbench.addons.swt.test
5-
Bundle-Version: 1.5.0.qualifier
5+
Bundle-Version: 1.5.100.qualifier
66
Bundle-Localization: plugin
77
Fragment-Host: org.eclipse.e4.ui.workbench.addons.swt;bundle-version="[1.1.0,2.0.0)"
88
Bundle-RequiredExecutionEnvironment: JavaSE-17
9-
Require-Bundle: org.junit;bundle-version="[4.12.0,5.0.0)",
10-
org.eclipse.e4.core.commands;bundle-version="[1.0.0,2.0.0)",
9+
Require-Bundle: org.eclipse.e4.core.commands;bundle-version="[1.0.0,2.0.0)",
1110
org.eclipse.core.databinding.observable;bundle-version="[1.4.0,2.0.0)",
1211
org.eclipse.jface.databinding;bundle-version="[1.6.200,2.0.0)",
13-
org.eclipse.e4.ui.workbench.swt;bundle-version="[0.12.100,1.0.0)"
12+
org.eclipse.e4.ui.workbench.swt;bundle-version="[0.12.100,1.0.0)",
13+
org.mockito.mockito-core;bundle-version="5.15.2",
14+
junit-jupiter-params;bundle-version="5.11.4",
15+
junit-jupiter-api;bundle-version="5.11.4",
16+
junit-platform-suite-api;bundle-version="1.11.4"
1417
Bundle-Vendor: %providerName
1518
Export-Package: org.eclipse.e4.ui.workbench.addons.minmax;x-internal:=true
1619
Automatic-Module-Name: org.eclipse.e4.ui.workbench.addons.swt.test

tests/org.eclipse.e4.ui.workbench.addons.swt.test/src/org/eclipse/e4/ui/workbench/addons/AllTests.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
import org.eclipse.e4.ui.workbench.addons.minmax.MaximizableChildrenTag;
55
import org.eclipse.e4.ui.workbench.addons.minmax.MaximizeBugTest;
66
import org.eclipse.e4.ui.workbench.addons.minmax.MaximizePartSashContainerPlaceholderTest;
7-
import org.junit.runner.RunWith;
8-
import org.junit.runners.Suite;
9-
import org.junit.runners.Suite.SuiteClasses;
7+
import org.junit.platform.suite.api.SelectClasses;
8+
import org.junit.platform.suite.api.Suite;
109

11-
@RunWith(Suite.class)
12-
@SuiteClasses({ //
10+
@Suite
11+
@SelectClasses({ //
1312
MaximizeBugTest.class, //
1413
MaximizePartSashContainerPlaceholderTest.class, //
1514
MaximizableChildrenTag.class, //

tests/org.eclipse.e4.ui.workbench.addons.swt.test/src/org/eclipse/e4/ui/workbench/addons/cleanupaddon/CleanupAddonTest.java

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2024 Vector Informatik GmbH and others.
2+
* Copyright (c) 2024, 2025 Vector Informatik GmbH and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,16 +10,15 @@
1010
*******************************************************************************/
1111
package org.eclipse.e4.ui.workbench.addons.cleanupaddon;
1212

13-
import static org.junit.Assert.assertFalse;
14-
import static org.junit.Assert.assertTrue;
15-
import static org.junit.Assume.assumeFalse;
13+
14+
import static org.junit.jupiter.api.Assertions.assertFalse;
15+
import static org.junit.jupiter.api.Assertions.assertTrue;
1616

1717
import java.net.MalformedURLException;
1818
import java.net.URL;
1919
import java.time.Duration;
2020
import java.util.function.Supplier;
2121

22-
import org.eclipse.core.runtime.Platform.OS;
2322
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
2423
import org.eclipse.e4.core.contexts.IEclipseContext;
2524
import org.eclipse.e4.ui.di.UISynchronize;
@@ -56,9 +55,11 @@
5655
import org.eclipse.swt.graphics.Image;
5756
import org.eclipse.swt.widgets.Display;
5857
import org.eclipse.swt.widgets.Shell;
59-
import org.junit.After;
60-
import org.junit.Before;
61-
import org.junit.Test;
58+
import org.junit.jupiter.api.AfterEach;
59+
import org.junit.jupiter.api.BeforeEach;
60+
import org.junit.jupiter.api.Test;
61+
import org.junit.jupiter.api.condition.DisabledOnOs;
62+
import org.junit.jupiter.api.condition.OS;
6263

6364
public class CleanupAddonTest {
6465
private static final Duration TIMEOUT = Duration.ofSeconds(30);
@@ -74,12 +75,12 @@ public class CleanupAddonTest {
7475
private MTrimmedWindow window;
7576
private IEclipseContext appContext;
7677

77-
@Before
78+
@BeforeEach
7879
public void before() {
7980
prepareApplicationModel();
8081
}
8182

82-
@After
83+
@AfterEach
8384
public void tearDown() {
8485
renderer.removeGui(window);
8586
renderer.stop();
@@ -188,12 +189,10 @@ public Image adornImage(Image toAdorn, Image adornment) {
188189
shell = (Shell) renderer.createGui(window);
189190
}
190191

192+
@DisabledOnOs(value = { OS.MAC }, //
193+
disabledReason = "not working reliably on Mac, see https://github.com/eclipse-platform/eclipse.platform.ui/issues/1784")
191194
@Test
192195
public void testRemovingPrimaryDataStackTransfersToRemainingStack() {
193-
assumeFalse(
194-
"not working reliably on Mac, see https://github.com/eclipse-platform/eclipse.platform.ui/issues/1784",
195-
OS.isMac());
196-
197196
PartStackUtil.initializeAsPrimaryDataStack(partStack1);
198197
assertTrue(PartStackUtil.isPrimaryDataStack(partStack1));
199198
assertFalse(PartStackUtil.isPrimaryDataStack(partStack2));
@@ -218,5 +217,4 @@ private static void waitForCondition(Supplier<Boolean> condition, Duration timeo
218217
Display.getCurrent().readAndDispatch();
219218
}
220219
}
221-
222220
}

tests/org.eclipse.e4.ui.workbench.addons.swt.test/src/org/eclipse/e4/ui/workbench/addons/minmax/MaximizableChildrenTag.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.eclipse.e4.ui.workbench.addons.minmax;
22

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

66
import java.net.MalformedURLException;
77
import java.net.URL;
@@ -41,9 +41,9 @@
4141
import org.eclipse.swt.graphics.Image;
4242
import org.eclipse.swt.widgets.Display;
4343
import org.eclipse.swt.widgets.Shell;
44-
import org.junit.After;
45-
import org.junit.Before;
46-
import org.junit.Test;
44+
import org.junit.jupiter.api.AfterEach;
45+
import org.junit.jupiter.api.BeforeEach;
46+
import org.junit.jupiter.api.Test;
4747

4848
public class MaximizableChildrenTag {
4949

@@ -57,12 +57,12 @@ public class MaximizableChildrenTag {
5757
private MTrimmedWindow window;
5858
private IEclipseContext appContext;
5959

60-
@Before
60+
@BeforeEach
6161
public void before() {
6262
prepareApplicationModel();
6363
}
6464

65-
@After
65+
@AfterEach
6666
public void tearDown() {
6767
renderer.removeGui(window);
6868
renderer.stop();

0 commit comments

Comments
 (0)