Skip to content

Commit 493d107

Browse files
vogellaclaude
authored andcommitted
Migrate org.eclipse.jface.tests.notifications from JUnit 4 to JUnit 5
This commit migrates the org.eclipse.jface.tests.notifications test bundle from JUnit 4 to JUnit 5. Changes: - Updated imports from org.junit.* to org.junit.jupiter.api.* - Replaced @before with @beforeeach - Replaced @after with @AfterEach - Changed test class from public to package-private (JUnit 5 best practice) - Changed all test methods from public to package-private - Removed org.junit dependency from MANIFEST.MF - Added org.hamcrest Import-Package (previously provided by org.junit bundle) Test Results: - All 5 tests passing (10 total including suite execution) - Compilation successful - No functional changes to test logic Files modified: - NotificationPopupTest.java 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent c127f94 commit 493d107

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

tests/org.eclipse.jface.tests.notifications/META-INF/MANIFEST.MF

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ Bundle-Name: Jface notifications tests
44
Bundle-SymbolicName: org.eclipse.jface.tests.notifications
55
Bundle-Vendor: Eclipse.org
66
Bundle-Version: 0.2.0.qualifier
7-
Import-Package: org.junit.jupiter.api;version="[5.14.0,6.0.0)",
7+
Import-Package: org.hamcrest,
8+
org.junit.jupiter.api;version="[5.14.0,6.0.0)",
89
org.junit.platform.suite.api;version="[1.14.0,2.0.0)"
910
Automatic-Module-Name: org.eclipse.jface.notifications.tests
1011
Bundle-RequiredExecutionEnvironment: JavaSE-17
11-
Require-Bundle: org.junit,
12-
org.eclipse.jface.notifications;bundle-version="0.4.0",
12+
Require-Bundle: org.eclipse.jface.notifications;bundle-version="0.4.0",
1313
org.eclipse.swt,
1414
org.eclipse.jface,
1515
org.eclipse.ui.forms,

tests/org.eclipse.jface.tests.notifications/src/org/eclipse/jface/tests/notifications/NotificationPopupTest.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,25 @@
3939
import org.hamcrest.BaseMatcher;
4040
import org.hamcrest.Description;
4141
import org.hamcrest.Matcher;
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("restriction")
47-
public class NotificationPopupTest {
47+
class NotificationPopupTest {
4848

4949
private Display display;
5050
private Builder builder;
5151
private Shell shell;
5252

53-
@Before
54-
public void setUp() {
53+
@BeforeEach
54+
void setUp() {
5555
this.display = Display.getDefault();
5656
this.builder = NotificationPopup.forDisplay(this.display);
5757
}
5858

59-
@After
60-
public void tearDown() {
59+
@AfterEach
60+
void tearDown() {
6161
if (shell != null) {
6262
shell.close();
6363
shell.dispose();
@@ -70,7 +70,7 @@ public void tearDown() {
7070
}
7171

7272
@Test
73-
public void createsWithTextAndTitle() {
73+
void createsWithTextAndTitle() {
7474
NotificationPopup notication = this.builder.text("This is a test").title("Hello World", false).delay(1).build();
7575
notication.open();
7676
List<Control> controls = getNotificationPopupControls(notication);
@@ -81,7 +81,7 @@ public void createsWithTextAndTitle() {
8181
}
8282

8383
@Test
84-
public void createsWithCloseButton() {
84+
void createsWithCloseButton() {
8585
NotificationPopup notication = this.builder.text("This is a test").title("Hello World", true).delay(1).build();
8686
notication.open();
8787
List<Control> controls = getNotificationPopupControls(notication);
@@ -91,7 +91,7 @@ public void createsWithCloseButton() {
9191
}
9292

9393
@Test
94-
public void createsWithTextContent() {
94+
void createsWithTextContent() {
9595
Text[] text = new Text[1];
9696
NotificationPopup notication = this.builder.title("Hello World", false).content(parent -> {
9797
text[0] = new Text(parent, SWT.NONE);
@@ -107,7 +107,7 @@ public void createsWithTextContent() {
107107
}
108108

109109
@Test
110-
public void createsWithTitleContent() {
110+
void createsWithTitleContent() {
111111
Text[] text = new Text[1];
112112
NotificationPopup notication = this.builder.title(parent -> {
113113
text[0] = new Text(parent, SWT.NONE);
@@ -122,7 +122,7 @@ public void createsWithTitleContent() {
122122
}
123123

124124
@Test
125-
public void createsForShell() {
125+
void createsForShell() {
126126
shell = WidgetFactory.shell(SWT.NONE).create(display);
127127
this.builder = NotificationPopup.forShell(shell);
128128

0 commit comments

Comments
 (0)