Skip to content

Commit 91966de

Browse files
committed
Migrate JUnit 4 tests to JUnit 5 in org.eclipse.jface.tests
1 parent 301653e commit 91966de

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+382
-374
lines changed

tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/dialogs/DialogSettingsTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
*******************************************************************************/
1616
package org.eclipse.jface.tests.dialogs;
1717

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.assertNull;
22-
import static org.junit.Assert.assertTrue;
23-
import static org.junit.Assert.fail;
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.assertNull;
22+
import static org.junit.jupiter.api.Assertions.assertTrue;
23+
import static org.junit.jupiter.api.Assertions.fail;
2424

2525
import java.io.IOException;
2626
import java.io.StringReader;
@@ -29,7 +29,7 @@
2929

3030
import org.eclipse.jface.dialogs.DialogSettings;
3131
import org.eclipse.jface.dialogs.IDialogSettings;
32-
import org.junit.Test;
32+
import org.junit.jupiter.api.Test;
3333

3434
public class DialogSettingsTest {
3535

tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/dialogs/DialogTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
******************************************************************************/
1414
package org.eclipse.jface.tests.dialogs;
1515

16-
import static org.junit.Assert.assertTrue;
16+
import static org.junit.jupiter.api.Assertions.assertTrue;
1717

1818
import org.eclipse.jface.dialogs.Dialog;
1919
import org.eclipse.jface.dialogs.IDialogConstants;
@@ -22,8 +22,8 @@
2222
import org.eclipse.swt.widgets.Composite;
2323
import org.eclipse.swt.widgets.Control;
2424
import org.eclipse.swt.widgets.Shell;
25-
import org.junit.After;
26-
import org.junit.Test;
25+
import org.junit.jupiter.api.AfterEach;
26+
import org.junit.jupiter.api.Test;
2727

2828
public class DialogTest {
2929

@@ -32,7 +32,7 @@ public class DialogTest {
3232
*/
3333
private Dialog dialog;
3434

35-
@After
35+
@AfterEach
3636
public void tearDown() throws Exception {
3737
if (dialog != null) {
3838
// close the dialog
@@ -69,9 +69,9 @@ public void testButtonAlignmentBug272583() {
6969
int cancelX = cancelBtn.getBounds().x;
7070

7171
if (okBtn.getDisplay().getDismissalAlignment() == SWT.LEFT) {
72-
assertTrue("The 'OK' button should be to the left of the 'Cancel' button", okX < cancelX);
72+
assertTrue(okX < cancelX, "The 'OK' button should be to the left of the 'Cancel' button");
7373
} else {
74-
assertTrue("The 'OK' button should be to the right of the 'Cancel' button", cancelX < okX);
74+
assertTrue(cancelX < okX, "The 'OK' button should be to the right of the 'Cancel' button");
7575
}
7676

7777
forceLayoutDialog.close();

tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/dialogs/InputDialogTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
package org.eclipse.jface.tests.dialogs;
1515

1616
import org.eclipse.jface.dialogs.InputDialog;
17-
import org.junit.After;
18-
import org.junit.Test;
17+
import org.junit.jupiter.api.AfterEach;
18+
import org.junit.jupiter.api.Test;
1919

2020
public class InputDialogTest {
2121

2222
private InputDialog dialog;
2323

24-
@After
24+
@AfterEach
2525
public void tearDown() throws Exception {
2626
if (dialog != null) {
2727
dialog.close();

tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/dialogs/PlainMessageDialogTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*******************************************************************************/
1313
package org.eclipse.jface.tests.dialogs;
1414

15-
import static org.junit.Assert.assertEquals;
15+
import static org.junit.jupiter.api.Assertions.assertEquals;
1616

1717
import java.util.Arrays;
1818

@@ -24,22 +24,22 @@
2424
import org.eclipse.swt.widgets.Display;
2525
import org.eclipse.swt.widgets.Label;
2626
import org.eclipse.swt.widgets.Shell;
27-
import org.junit.After;
28-
import org.junit.Before;
29-
import org.junit.Test;
27+
import org.junit.jupiter.api.AfterEach;
28+
import org.junit.jupiter.api.BeforeEach;
29+
import org.junit.jupiter.api.Test;
3030

3131
public class PlainMessageDialogTest {
3232

3333
private Builder builder;
3434
private PlainMessageDialog dialog;
3535

36-
@Before
36+
@BeforeEach
3737
public void setup() {
3838
Shell shell = new Shell(Display.getDefault());
3939
builder = PlainMessageDialog.getBuilder(shell, "My Dialog");
4040
}
4141

42-
@After
42+
@AfterEach
4343
public void tearDown() {
4444
if (dialog != null) {
4545
dialog.close();

tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/dialogs/ProgressIndicatorStyleTest.java

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

1515
package org.eclipse.jface.tests.dialogs;
1616

17-
import static org.junit.Assert.assertEquals;
17+
import static org.junit.jupiter.api.Assertions.assertEquals;
1818

1919
import java.lang.reflect.Field;
2020

2121
import org.eclipse.jface.dialogs.ProgressIndicator;
2222
import org.eclipse.swt.SWT;
2323
import org.eclipse.swt.widgets.ProgressBar;
2424
import org.eclipse.swt.widgets.Shell;
25-
import org.junit.Test;
25+
import org.junit.jupiter.api.Test;
2626

2727
/**
2828
* Test case to assert proper styles have been set for ProgressIndicator.

tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/dialogs/ProgressMonitorDialogTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616

1717
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
1818
import org.eclipse.swt.widgets.Display;
19-
import org.junit.Before;
20-
import org.junit.Test;
19+
import org.junit.jupiter.api.BeforeEach;
20+
import org.junit.jupiter.api.Test;
2121

2222
public class ProgressMonitorDialogTest {
2323

24-
@Before
24+
@BeforeEach
2525
public void setUp() throws Exception {
2626
// ensure we've initialized a display for this thread
2727
Display.getDefault();

tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/dialogs/SafeRunnableErrorTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
******************************************************************************/
1414
package org.eclipse.jface.tests.dialogs;
1515

16-
import static org.junit.Assert.assertEquals;
16+
import static org.junit.jupiter.api.Assertions.assertEquals;
1717

1818
import org.eclipse.core.runtime.ISafeRunnable;
1919
import org.eclipse.jface.util.SafeRunnable;
20-
import org.junit.Test;
20+
import org.junit.jupiter.api.Test;
2121

2222
/**
2323
* NOTE - these tests are not really very good, in order to really test this you

tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/dialogs/StatusDialogTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
******************************************************************************/
1414
package org.eclipse.jface.tests.dialogs;
1515

16-
import static org.junit.Assert.assertEquals;
16+
import static org.junit.jupiter.api.Assertions.assertEquals;
1717

1818
import org.eclipse.core.runtime.IStatus;
1919
import org.eclipse.core.runtime.Status;
@@ -22,9 +22,9 @@
2222
import org.eclipse.swt.widgets.Composite;
2323
import org.eclipse.swt.widgets.Control;
2424
import org.eclipse.swt.widgets.Shell;
25-
import org.junit.After;
26-
import org.junit.Before;
27-
import org.junit.Test;
25+
import org.junit.jupiter.api.AfterEach;
26+
import org.junit.jupiter.api.BeforeEach;
27+
import org.junit.jupiter.api.Test;
2828

2929
public class StatusDialogTest {
3030

@@ -41,12 +41,12 @@ public void testEscapeAmpesandInStatusLabelBug395426() {
4141
assertEquals("&&", statusLabel.getText());
4242
}
4343

44-
@Before
44+
@BeforeEach
4545
public void setUp() throws Exception {
4646
shell = new Shell();
4747
}
4848

49-
@After
49+
@AfterEach
5050
public void tearDown() throws Exception {
5151
shell.dispose();
5252
}

tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/dialogs/TitleAreaDialogTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
import org.eclipse.jface.resource.ResourceLocator;
1919
import org.eclipse.swt.graphics.Image;
2020
import org.eclipse.swt.widgets.Shell;
21-
import org.junit.After;
22-
import org.junit.Test;
21+
import org.junit.jupiter.api.AfterEach;
22+
import org.junit.jupiter.api.Test;
2323

2424
public class TitleAreaDialogTest {
2525

@@ -28,7 +28,7 @@ public class TitleAreaDialogTest {
2828

2929
private TitleAreaDialog dialog;
3030

31-
@After
31+
@AfterEach
3232
public void tearDown() throws Exception {
3333
if (dialog != null) {
3434
dialog.close();

tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/images/DecorationOverlayIconTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
*******************************************************************************/
1414
package org.eclipse.jface.tests.images;
1515

16-
import static org.junit.Assert.assertEquals;
17-
import static org.junit.Assert.assertFalse;
18-
import static org.junit.Assert.assertNotEquals;
19-
import static org.junit.Assert.assertNotNull;
20-
import static org.junit.Assert.assertTrue;
16+
import static org.junit.jupiter.api.Assertions.assertEquals;
17+
import static org.junit.jupiter.api.Assertions.assertFalse;
18+
import static org.junit.jupiter.api.Assertions.assertNotEquals;
19+
import static org.junit.jupiter.api.Assertions.assertNotNull;
20+
import static org.junit.jupiter.api.Assertions.assertTrue;
2121

2222
import org.eclipse.jface.dialogs.Dialog;
2323
import org.eclipse.jface.resource.ImageDescriptor;
@@ -26,8 +26,8 @@
2626
import org.eclipse.jface.viewers.DecorationOverlayIcon;
2727
import org.eclipse.jface.viewers.IDecoration;
2828
import org.eclipse.swt.graphics.Image;
29-
import org.junit.Before;
30-
import org.junit.Test;
29+
import org.junit.jupiter.api.BeforeEach;
30+
import org.junit.jupiter.api.Test;
3131

3232
/**
3333
* @since 3.13
@@ -41,7 +41,7 @@ public class DecorationOverlayIconTest {
4141
private ImageDescriptor overlayDescriptor1;
4242
private ImageDescriptor overlayDescriptor2;
4343

44-
@Before
44+
@BeforeEach
4545
public void setUp() {
4646
ImageRegistry imageRegistry = JFaceResources.getImageRegistry();
4747
baseImage1 = imageRegistry.get(Dialog.DLG_IMG_HELP);

0 commit comments

Comments
 (0)