Skip to content

Commit 6fabf86

Browse files
vogellaakurtakov
authored andcommitted
Complete JUnit 5 migration for JFace label provider tests
1 parent 63d03fc commit 6fabf86

7 files changed

Lines changed: 39 additions & 45 deletions

tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/labelProviders/ColorAndFontLabelProviderTest.java

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

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

17-
import static org.junit.Assert.assertEquals;
18-
import static org.junit.Assert.assertNotEquals;
17+
import static org.junit.jupiter.api.Assertions.assertEquals;
18+
import static org.junit.jupiter.api.Assertions.assertNotEquals;
1919

2020
import org.eclipse.jface.viewers.IColorProvider;
2121
import org.eclipse.jface.viewers.IFontProvider;
@@ -83,21 +83,21 @@ public void testColorsAndFonts() {
8383
Table table = (Table) fViewer.getControl();
8484
TableItem item = table.getItem(0);
8585

86-
assertEquals("Background was not set", item.getBackground(0), background);
87-
assertEquals("Foreground was not set", item.getForeground(0), foreground);
88-
assertEquals("Font was not set", item.getFont(0), font);
86+
assertEquals(background, item.getBackground(0), "Background was not set");
87+
assertEquals(foreground, item.getForeground(0), "Foreground was not set");
88+
assertEquals(font, item.getFont(0), "Font was not set");
8989

9090
Font oldFont = font;
9191

9292
clearColors();
9393
fViewer.refresh(item.getData());
9494

9595
Display display = table.getDisplay();
96-
assertEquals("Background was not cleared", item.getBackground(0),
97-
display.getSystemColor(SWT.COLOR_LIST_BACKGROUND));
98-
assertEquals("Foreground was not cleared", item.getForeground(0),
99-
display.getSystemColor(SWT.COLOR_LIST_FOREGROUND));
100-
assertNotEquals("Font was not cleared", item.getFont(0).getFontData()[0], oldFont.getFontData()[0]);
96+
assertEquals(display.getSystemColor(SWT.COLOR_LIST_BACKGROUND), item.getBackground(0),
97+
"Background was not cleared");
98+
assertEquals(display.getSystemColor(SWT.COLOR_LIST_FOREGROUND), item.getForeground(0),
99+
"Foreground was not cleared");
100+
assertNotEquals(oldFont.getFontData()[0], item.getFont(0).getFontData()[0], "Font was not cleared");
101101

102102
}
103103

tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/labelProviders/ColorAndFontViewerLabelProviderTest.java

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

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

17-
import static org.junit.Assert.assertEquals;
18-
import static org.junit.Assert.assertNotEquals;
17+
import static org.junit.jupiter.api.Assertions.assertEquals;
18+
import static org.junit.jupiter.api.Assertions.assertNotEquals;
1919

2020
import org.eclipse.jface.viewers.IColorProvider;
2121
import org.eclipse.jface.viewers.IFontProvider;
@@ -91,21 +91,21 @@ public void testColorsAndFonts() {
9191
Table table = (Table) fViewer.getControl();
9292
TableItem item = table.getItem(0);
9393

94-
assertEquals("Background was not set", item.getBackground(0), background);
95-
assertEquals("Foreground was not set", item.getForeground(0), foreground);
96-
assertEquals("Font was not set", item.getFont(0), font);
94+
assertEquals(background, item.getBackground(0), "Background was not set");
95+
assertEquals(foreground, item.getForeground(0), "Foreground was not set");
96+
assertEquals(font, item.getFont(0), "Font was not set");
9797

9898
Font oldFont = font;
9999

100100
clearColors();
101101
fViewer.refresh(item.getData());
102102

103103
Display display = table.getDisplay();
104-
assertEquals("Background was not cleared", item.getBackground(0),
105-
display.getSystemColor(SWT.COLOR_LIST_BACKGROUND));
106-
assertEquals("Foreground was not cleared", item.getForeground(0),
107-
display.getSystemColor(SWT.COLOR_LIST_FOREGROUND));
108-
assertNotEquals("Font was not cleared", item.getFont(0).getFontData()[0], oldFont.getFontData()[0]);
104+
assertEquals(display.getSystemColor(SWT.COLOR_LIST_BACKGROUND), item.getBackground(0),
105+
"Background was not cleared");
106+
assertEquals(display.getSystemColor(SWT.COLOR_LIST_FOREGROUND), item.getForeground(0),
107+
"Foreground was not cleared");
108+
assertNotEquals(oldFont.getFontData()[0], item.getFont(0).getFontData()[0], "Font was not cleared");
109109

110110
}
111111

tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/labelProviders/CompositeLabelProviderTableTest.java

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

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

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

1919
import org.eclipse.jface.viewers.IColorProvider;
2020
import org.eclipse.jface.viewers.IFontProvider;
@@ -80,9 +80,9 @@ public void testColorsAndFonts() {
8080
Table table = (Table) fViewer.getControl();
8181
TableItem item = table.getItem(0);
8282

83-
assertEquals("Background was not set", item.getBackground(0), background);
84-
assertEquals("Foreground was not set", item.getForeground(0), foreground);
85-
assertEquals("Font was not set", item.getFont(0), font);
83+
assertEquals(background, item.getBackground(0), "Background was not set");
84+
assertEquals(foreground, item.getForeground(0), "Foreground was not set");
85+
assertEquals(font, item.getFont(0), "Font was not set");
8686

8787
}
8888

tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/labelProviders/DecoratingLabelProviderTests.java

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

16-
import org.junit.runner.JUnitCore;
17-
1816
import org.junit.platform.suite.api.SelectClasses;
1917
import org.junit.platform.suite.api.Suite;
2018

@@ -25,8 +23,4 @@
2523
IDecorationContextTest.class })
2624
public class DecoratingLabelProviderTests {
2725

28-
public static void main(String[] args) {
29-
JUnitCore.main(DecoratingLabelProviderTests.class.getName());
30-
}
31-
3226
}

tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/labelProviders/DecoratingLabelProviderTreePathTest.java

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

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

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

1919
import org.eclipse.jface.viewers.IColorProvider;
2020
import org.eclipse.jface.viewers.IFontProvider;
@@ -85,9 +85,9 @@ public void testColorsAndFonts() {
8585
Tree tree = (Tree) fViewer.getControl();
8686
TreeItem item = tree.getItem(0);
8787

88-
assertEquals("Background was not set", item.getBackground(0), background);
89-
assertEquals("Foreground was not set", item.getForeground(0), foreground);
90-
assertEquals("Font was not set", item.getFont(0), font);
88+
assertEquals(background, item.getBackground(0), "Background was not set");
89+
assertEquals(foreground, item.getForeground(0), "Foreground was not set");
90+
assertEquals(font, item.getFont(0), "Font was not set");
9191

9292
}
9393
}

tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/labelProviders/DecoratingLabelProviderTreeTest.java

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

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

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

1919
import org.eclipse.jface.viewers.DecoratingLabelProvider;
2020
import org.eclipse.jface.viewers.IColorProvider;
@@ -74,9 +74,9 @@ public void testColorsAndFonts() {
7474
Tree tree = (Tree) fViewer.getControl();
7575
TreeItem item = tree.getItem(0);
7676

77-
assertEquals("Background was not set", item.getBackground(0), background);
78-
assertEquals("Foreground was not set", item.getForeground(0), foreground);
79-
assertEquals("Font was not set", item.getFont(0), font);
77+
assertEquals(background, item.getBackground(0), "Background was not set");
78+
assertEquals(foreground, item.getForeground(0), "Foreground was not set");
79+
assertEquals(font, item.getFont(0), "Font was not set");
8080

8181
}
8282

tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/labelProviders/DecoratingStyledCellLabelProviderTest.java

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

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

17-
import static org.junit.Assert.assertEquals;
18-
import static org.junit.Assert.assertFalse;
19-
import static org.junit.Assert.assertNotNull;
20-
import static org.junit.Assert.assertNotSame;
21-
import static org.junit.Assert.assertNull;
22-
import static org.junit.Assert.assertTrue;
23-
import static org.junit.Assert.fail;
17+
import static org.junit.jupiter.api.Assertions.assertEquals;
18+
import static org.junit.jupiter.api.Assertions.assertFalse;
19+
import static org.junit.jupiter.api.Assertions.assertNotNull;
20+
import static org.junit.jupiter.api.Assertions.assertNotSame;
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 org.eclipse.core.runtime.AssertionFailedException;
2626
import org.eclipse.jface.resource.JFaceResources;

0 commit comments

Comments
 (0)