From d179e6ec58ebef3ca376de46cf17dd50aa24e7b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=8A?= =?UTF-8?q?=D1=80=20=D0=9A=D1=83=D1=80=D1=82=D0=B0=D0=BA=D0=BE=D0=B2?= Date: Sun, 6 Nov 2022 21:56:51 +0200 Subject: [PATCH] Migrate o.e.e4.ui.tests.css.swt to JUnit 5 --- .../CSS SWT Test Suite.launch | 37 --------- .../META-INF/MANIFEST.MF | 6 +- .../resources/CSSResourcesHelpersTest.java | 14 ++-- .../SWTResourceRegistryKeyFactoryTest.java | 14 ++-- .../resources/SWTResourcesRegistryTest.java | 11 ++- .../swt/helpers/CSSSWTColorHelperTest.java | 23 +++--- .../css/swt/helpers/CSSSWTFontHelperTest.java | 28 +++---- .../helpers/EclipsePreferencesHelperTest.java | 18 ++--- ...enceOverriddenByCssChangeListenerTest.java | 10 +-- .../EclipsePreferencesHandlerTest.java | 28 +++---- .../e4/ui/tests/css/CssSwtTestSuite.java | 58 ++++---------- .../css/forms/ExpandableCompositeTest.java | 12 +-- .../e4/ui/tests/css/forms/SectionTest.java | 12 +-- .../tabbed/TabbedPropertiesListTest.java | 10 +-- .../tabbed/TabbedPropertiesTitleTest.java | 12 +-- .../e4/ui/tests/css/swt/Bug419482Test.java | 16 ++-- .../e4/ui/tests/css/swt/Bug459961Test.java | 18 ++--- .../e4/ui/tests/css/swt/ButtonTest.java | 31 ++++---- .../e4/ui/tests/css/swt/CSSSWTTestCase.java | 14 ++-- .../e4/ui/tests/css/swt/CSSSWTWidgetTest.java | 36 ++++----- .../e4/ui/tests/css/swt/CTabFolderTest.java | 42 +++++----- .../e4/ui/tests/css/swt/CTabItemTest.java | 78 +++++++++---------- .../ui/tests/css/swt/ColorDefinitionTest.java | 22 +++--- .../e4/ui/tests/css/swt/CompositeTest.java | 9 +-- .../e4/ui/tests/css/swt/DescendentTest.java | 6 +- .../ui/tests/css/swt/FontDefinitionTest.java | 22 +++--- .../e4/ui/tests/css/swt/GradientTest.java | 26 +++---- .../css/swt/IEclipsePreferencesTest.java | 7 +- .../tests/css/swt/IdClassLabelColorTest.java | 12 +-- .../e4/ui/tests/css/swt/InheritTest.java | 14 ++-- .../tests/css/swt/InnerClassElementTest.java | 6 +- .../e4/ui/tests/css/swt/LabelTest.java | 17 ++-- .../eclipse/e4/ui/tests/css/swt/LinkTest.java | 6 +- .../e4/ui/tests/css/swt/MarginTest.java | 26 +++---- .../e4/ui/tests/css/swt/ShellActiveTest.java | 10 +-- .../e4/ui/tests/css/swt/ShellTest.java | 28 +++---- .../e4/ui/tests/css/swt/TableTest.java | 8 +- .../ui/tests/css/swt/TestPropertyHelper.java | 36 +++------ .../ui/tests/css/swt/TextTransformTest.java | 4 +- .../e4/ui/tests/css/swt/ThemeTest.java | 24 +++--- .../ui/tests/css/swt/ThemesExtensionTest.java | 14 ++-- .../e4/ui/tests/css/swt/ToolItemTest.java | 18 ++--- .../eclipse/e4/ui/tests/css/swt/TreeTest.java | 8 +- 43 files changed, 377 insertions(+), 474 deletions(-) delete mode 100644 tests/org.eclipse.e4.ui.tests.css.swt/CSS SWT Test Suite.launch diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/CSS SWT Test Suite.launch b/tests/org.eclipse.e4.ui.tests.css.swt/CSS SWT Test Suite.launch deleted file mode 100644 index 0ee75849004..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/CSS SWT Test Suite.launch +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/META-INF/MANIFEST.MF b/tests/org.eclipse.e4.ui.tests.css.swt/META-INF/MANIFEST.MF index 0f018f51abf..203bba295ba 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/META-INF/MANIFEST.MF +++ b/tests/org.eclipse.e4.ui.tests.css.swt/META-INF/MANIFEST.MF @@ -3,8 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.e4.ui.tests.css.swt; singleton:=true Bundle-Version: 0.11.600.qualifier -Require-Bundle: org.junit, - org.eclipse.swt, +Require-Bundle: org.eclipse.swt, org.eclipse.e4.ui.css.core, org.eclipse.e4.ui.css.swt, org.w3c.css.sac, @@ -18,6 +17,9 @@ Require-Bundle: org.junit, Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-11 Import-Package: org.eclipse.core.runtime;version="3.5.0", + org.junit.jupiter.api;version="5.9.1", + org.junit.jupiter.api.function, + org.junit.platform.suite.api;version="1.9.1", org.osgi.framework;version="1.7.0";resolution:=optional, org.osgi.service.event;version="1.3.0";resolution:=optional, org.osgi.util.tracker;version="1.5.3" diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/core/resources/CSSResourcesHelpersTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/core/resources/CSSResourcesHelpersTest.java index 993588889e5..7d1dfccda2a 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/core/resources/CSSResourcesHelpersTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/core/resources/CSSResourcesHelpersTest.java @@ -16,17 +16,17 @@ import static org.eclipse.e4.ui.css.core.resources.CSSResourcesHelpers.getCSSFontPropertiesKey; import static org.eclipse.e4.ui.css.core.resources.CSSResourcesHelpers.getCSSValueKey; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import org.eclipse.e4.ui.css.core.dom.properties.css2.CSS2FontProperties; import org.eclipse.e4.ui.css.swt.helpers.CSSSWTHelperTestCase; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.w3c.dom.css.CSSPrimitiveValue; public class CSSResourcesHelpersTest extends CSSSWTHelperTestCase { @Test - public void testGetCSSValueKeyWhenFont() { + void testGetCSSValueKeyWhenFont() { CSS2FontProperties fontProperties = fontProperties("Arial", 10, null, null); String result = getCSSValueKey(fontProperties); assertNotNull(result); @@ -34,7 +34,7 @@ public void testGetCSSValueKeyWhenFont() { } @Test - public void testGetCSSValueKeyWhenDefinitionAsFontFamily() { + void testGetCSSValueKeyWhenDefinitionAsFontFamily() { CSS2FontProperties fontProperties = fontProperties(addFontDefinitionMarker("symbolicName"), 10, null, null); String result = getCSSValueKey(fontProperties); assertNotNull(result); @@ -42,7 +42,7 @@ public void testGetCSSValueKeyWhenDefinitionAsFontFamily() { } @Test - public void testGetCSSValueKeyWhenRgbAsColorValue() { + void testGetCSSValueKeyWhenRgbAsColorValue() { CSSPrimitiveValue colorValue = colorValue("rgb(255,0,0)"); String result = getCSSValueKey(colorValue); assertNotNull(result); @@ -50,7 +50,7 @@ public void testGetCSSValueKeyWhenRgbAsColorValue() { } @Test - public void testGetCSSValueKeyWhenDefinitionAsColorValue() { + void testGetCSSValueKeyWhenDefinitionAsColorValue() { CSSPrimitiveValue colorValue = colorValue(addColorDefinitionMarker("symbolicName")); String result = getCSSValueKey(colorValue); diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/core/resources/SWTResourceRegistryKeyFactoryTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/core/resources/SWTResourceRegistryKeyFactoryTest.java index e5583eb7812..5df7897a64a 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/core/resources/SWTResourceRegistryKeyFactoryTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/core/resources/SWTResourceRegistryKeyFactoryTest.java @@ -14,21 +14,21 @@ *******************************************************************************/ package org.eclipse.e4.ui.css.core.resources; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; import org.eclipse.e4.ui.css.core.dom.properties.css2.CSS2FontProperties; import org.eclipse.e4.ui.css.swt.helpers.CSSSWTHelperTestCase; import org.eclipse.e4.ui.css.swt.resources.ResourceByDefinitionKey; import org.eclipse.e4.ui.css.swt.resources.SWTResourceRegistryKeyFactory; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.w3c.dom.css.CSSPrimitiveValue; public class SWTResourceRegistryKeyFactoryTest extends CSSSWTHelperTestCase { private SWTResourceRegistryKeyFactory factory = new SWTResourceRegistryKeyFactory(); @Test - public void testCreateKeyWhenFontProperty() { + void testCreateKeyWhenFontProperty() { CSS2FontProperties fontProperties = fontProperties("Arial", 12, CSS_ITALIC, CSS_BOLD); Object result = factory.createKey(fontProperties); @@ -37,7 +37,7 @@ public void testCreateKeyWhenFontProperty() { } @Test - public void testCreateKeyWhenColorValue() { + void testCreateKeyWhenColorValue() { CSSPrimitiveValue colorValue = colorValue("red"); Object result = factory.createKey(colorValue); @@ -47,7 +47,7 @@ public void testCreateKeyWhenColorValue() { } @Test - public void testCreateKeyWhenFontByDefinition() { + void testCreateKeyWhenFontByDefinition() { CSS2FontProperties fontProperties = null; try { fontProperties = fontProperties("#font-by-definition", 12, CSS_ITALIC, CSS_BOLD); @@ -62,7 +62,7 @@ public void testCreateKeyWhenFontByDefinition() { } @Test - public void testCreateKeyWhenColorByDefinition() { + void testCreateKeyWhenColorByDefinition() { CSSPrimitiveValue colorValue = colorValue("#color-by-definition"); Object result = factory.createKey(colorValue); diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/core/resources/SWTResourcesRegistryTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/core/resources/SWTResourcesRegistryTest.java index d12cdce6014..0b117c101d3 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/core/resources/SWTResourcesRegistryTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/core/resources/SWTResourcesRegistryTest.java @@ -14,8 +14,8 @@ *******************************************************************************/ package org.eclipse.e4.ui.css.core.resources; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; @@ -28,11 +28,11 @@ import org.eclipse.e4.ui.css.swt.resources.SWTResourcesRegistry; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.Resource; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class SWTResourcesRegistryTest { @Test - public void testRemoveResourcesByKeyTypeAndType() { + void testRemoveResourcesByKeyTypeAndType() { //given final Resource resource1 = mock(Resource.class); final Resource resource2 = mock(Resource.class); @@ -62,8 +62,7 @@ public void testRemoveResourcesByKeyTypeAndType() { assertTrue(resources.containsKey("key1")); } - public static class SWTResourcesRegistryTestable extends - SWTResourcesRegistry { + public static class SWTResourcesRegistryTestable extends SWTResourcesRegistry { public SWTResourcesRegistryTestable() { super(null); } diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/CSSSWTColorHelperTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/CSSSWTColorHelperTest.java index 3e66b8bb615..5e85629211a 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/CSSSWTColorHelperTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/CSSSWTColorHelperTest.java @@ -15,36 +15,37 @@ package org.eclipse.e4.ui.css.swt.helpers; import static org.eclipse.e4.ui.css.swt.helpers.CSSSWTColorHelper.getSWTColor; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Display; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.w3c.dom.css.CSSValue; public class CSSSWTColorHelperTest extends CSSSWTHelperTestCase { private Display display; - @Before + @BeforeEach public void setUp() { display = Display.getDefault(); } @Test - public void testGetSWTColor() { + void testGetSWTColor() { Color result = getSWTColor(colorValue("red"), display); - assertNotNull(result); + Assertions.assertNotNull(result); assertEquals(255, result.getRed()); assertEquals(0, result.getBlue()); assertEquals(0, result.getGreen()); } @Test - public void testGetSWTColorWhenNotSupportedColorType() { + void testGetSWTColorWhenNotSupportedColorType() { Color result = getSWTColor(colorValue("123213", CSSValue.CSS_CUSTOM), display); @@ -52,7 +53,7 @@ public void testGetSWTColorWhenNotSupportedColorType() { } @Test - public void testGetSWTColorWhenInvalidColorValue() { + void testGetSWTColorWhenInvalidColorValue() { Color result = getSWTColor(colorValue("asdsad12"), display); assertNotNull(result); @@ -62,7 +63,7 @@ public void testGetSWTColorWhenInvalidColorValue() { } @Test - public void testGetSWTColorWhenColorFromDefinition() { + void testGetSWTColorWhenColorFromDefinition() { registerColorProviderWith("org.eclipse.jdt.debug.ui.InDeadlockColor", new RGB(0, 255, 0)); Color result = getSWTColor( diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/CSSSWTFontHelperTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/CSSSWTFontHelperTest.java index 3fc9b3c4cc5..2a2764b6360 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/CSSSWTFontHelperTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/CSSSWTFontHelperTest.java @@ -15,16 +15,16 @@ package org.eclipse.e4.ui.css.swt.helpers; import static org.eclipse.e4.ui.css.swt.helpers.CSSSWTFontHelper.getFontData; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.FontData; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class CSSSWTFontHelperTest extends CSSSWTHelperTestCase { @Test - public void testGetFontData() { + void testGetFontData() { FontData result = getFontData(fontProperties("Times", 11, CSS_ITALIC, CSS_BOLD), new FontData()); @@ -34,7 +34,7 @@ public void testGetFontData() { } @Test - public void testGetFontDataWithoutOldFont() { + void testGetFontDataWithoutOldFont() { FontData result = getFontData(fontProperties("Times", 11, CSS_ITALIC, CSS_BOLD), null); @@ -44,7 +44,7 @@ public void testGetFontDataWithoutOldFont() { } @Test - public void testGetFontDataStyledFont() { + void testGetFontDataStyledFont() { FontData result = getFontData(fontProperties("Times", 11, "normal", "normal"), new FontData("Courier", 11, SWT.ITALIC | SWT.BOLD)); @@ -54,7 +54,7 @@ public void testGetFontDataStyledFont() { } @Test - public void testGetFontDataWhenMissingFamilyInCss() { + void testGetFontDataWhenMissingFamilyInCss() { FontData result = getFontData(fontProperties(null, 11, CSS_ITALIC, CSS_BOLD), new FontData("Courier", 5, SWT.NORMAL)); @@ -64,7 +64,7 @@ public void testGetFontDataWhenMissingFamilyInCss() { } @Test - public void testGetFontDataWhenMissingSizeInCss() { + void testGetFontDataWhenMissingSizeInCss() { FontData result = getFontData(fontProperties("Arial", null, CSS_ITALIC, CSS_BOLD), new FontData("Courier", 5, SWT.NORMAL)); @@ -74,7 +74,7 @@ public void testGetFontDataWhenMissingSizeInCss() { } @Test - public void testGetFontDataWhenMissingStyleInCss() { + void testGetFontDataWhenMissingStyleInCss() { FontData result = getFontData(fontProperties("Times", 11, null, CSS_BOLD), new FontData("Courier", 5, SWT.ITALIC)); @@ -84,7 +84,7 @@ public void testGetFontDataWhenMissingStyleInCss() { } @Test - public void testGetFontDataWhenMissingWeightInCss() { + void testGetFontDataWhenMissingWeightInCss() { FontData result = getFontData(fontProperties("Times", 11, CSS_ITALIC, null), new FontData("Courier", 5, SWT.BOLD)); @@ -94,7 +94,7 @@ public void testGetFontDataWhenMissingWeightInCss() { } @Test - public void testGetFontDataWhenMissingAllInCss() { + void testGetFontDataWhenMissingAllInCss() { FontData result = getFontData(fontProperties(null, null, null, null), new FontData("Courier", 11, SWT.ITALIC | SWT.BOLD)); @@ -104,7 +104,7 @@ public void testGetFontDataWhenMissingAllInCss() { } @Test - public void testGetFontDataWhenFontFamilyFromDefinitionAndOverwritingSize() { + void testGetFontDataWhenFontFamilyFromDefinitionAndOverwritingSize() { registerFontProviderWith("org.eclipse.jface.bannerfont", "Arial", 15, SWT.ITALIC | SWT.BOLD); FontData result = getFontData( @@ -117,7 +117,7 @@ public void testGetFontDataWhenFontFamilyFromDefinitionAndOverwritingSize() { } @Test - public void testGetFontDataWhenFontFamilyFromDefinitionAndOverwritingStyle() { + void testGetFontDataWhenFontFamilyFromDefinitionAndOverwritingStyle() { registerFontProviderWith("org.eclipse.jface.bannerfont", "Arial", 15, SWT.BOLD); FontData result = getFontData( @@ -130,7 +130,7 @@ public void testGetFontDataWhenFontFamilyFromDefinitionAndOverwritingStyle() { } @Test - public void testGetFontDataWhenFontFamilyFromDefinitionAndOverwritingWeight() { + void testGetFontDataWhenFontFamilyFromDefinitionAndOverwritingWeight() { registerFontProviderWith("org.eclipse.jface.bannerfont", "Arial", 15, SWT.ITALIC); FontData result = getFontData( @@ -143,7 +143,7 @@ public void testGetFontDataWhenFontFamilyFromDefinitionAndOverwritingWeight() { } @Test - public void testGetFontDataFromFontDefinition() { + void testGetFontDataFromFontDefinition() { registerFontProviderWith("org.eclipse.jface.bannerfont", "Arial", 15, SWT.ITALIC | SWT.BOLD); FontData result = getFontData( diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/EclipsePreferencesHelperTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/EclipsePreferencesHelperTest.java index 9fe7ad3dc58..ce0d5cccc80 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/EclipsePreferencesHelperTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/EclipsePreferencesHelperTest.java @@ -22,10 +22,10 @@ import static org.eclipse.e4.ui.css.swt.helpers.EclipsePreferencesHelper.getPreferenceChangeListener; import static org.eclipse.e4.ui.css.swt.helpers.EclipsePreferencesHelper.removeOverriddenByCssProperty; import static org.eclipse.e4.ui.css.swt.helpers.EclipsePreferencesHelper.removeOverriddenPropertyNames; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -34,12 +34,12 @@ import org.eclipse.core.internal.preferences.EclipsePreferences; import org.eclipse.core.runtime.preferences.IEclipsePreferences; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class EclipsePreferencesHelperTest { @Test - public void testAppendOverriddenPropertyName() { + void testAppendOverriddenPropertyName() { // given IEclipsePreferences preferences = spy(new EclipsePreferences()); @@ -59,7 +59,7 @@ public void testAppendOverriddenPropertyName() { } @Test - public void testGetOverriddenPropertyNames() { + void testGetOverriddenPropertyNames() { // given IEclipsePreferences preferences = new EclipsePreferences(); appendOverriddenPropertyName(preferences, "prop1"); @@ -77,7 +77,7 @@ public void testGetOverriddenPropertyNames() { } @Test - public void testRemoveOverriddenPropertyNames() { + void testRemoveOverriddenPropertyNames() { // given IEclipsePreferences preferences = spy(new EclipsePreferences()); appendOverriddenPropertyName(preferences, "prop1"); @@ -92,7 +92,7 @@ public void testRemoveOverriddenPropertyNames() { } @Test - public void testRemoveOverriddenByCssProperty() { + void testRemoveOverriddenByCssProperty() { // given IEclipsePreferences preferences = new EclipsePreferences(); diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/PreferenceOverriddenByCssChangeListenerTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/PreferenceOverriddenByCssChangeListenerTest.java index 8a59af1da9b..cda300970db 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/PreferenceOverriddenByCssChangeListenerTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/PreferenceOverriddenByCssChangeListenerTest.java @@ -26,12 +26,12 @@ import org.eclipse.core.runtime.preferences.IEclipsePreferences; import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent; import org.eclipse.e4.ui.css.swt.helpers.EclipsePreferencesHelper.PreferenceOverriddenByCssChangeListener; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class PreferenceOverriddenByCssChangeListenerTest { @Test - public void testPreferenceChangeEvent() { + void testPreferenceChangeEvent() { // given IEclipsePreferences preferences = new EclipsePreferences(); preferences.put(PROPS_OVERRIDDEN_BY_CSS_PROP, SEPARATOR + "name" + SEPARATOR); @@ -49,7 +49,7 @@ public void testPreferenceChangeEvent() { } @Test - public void testPreferenceChangeEventWhenAddPropertyEvent() { + void testPreferenceChangeEventWhenAddPropertyEvent() { // given IEclipsePreferences preferences = new EclipsePreferences(); preferences.put(PROPS_OVERRIDDEN_BY_CSS_PROP, SEPARATOR + "name" + SEPARATOR); @@ -67,7 +67,7 @@ public void testPreferenceChangeEventWhenAddPropertyEvent() { } @Test - public void testPreferenceChangeEventWhenRemovePropertyEvent() { + void testPreferenceChangeEventWhenRemovePropertyEvent() { // given IEclipsePreferences preferences = new EclipsePreferences(); preferences.put(PROPS_OVERRIDDEN_BY_CSS_PROP, SEPARATOR + "name" + SEPARATOR); @@ -85,7 +85,7 @@ public void testPreferenceChangeEventWhenRemovePropertyEvent() { } @Test - public void testPreferenceChangeEventWhenModifyPropertyEventButPropertyIsNotOverriddenByCss() { + void testPreferenceChangeEventWhenModifyPropertyEventButPropertyIsNotOverriddenByCss() { // given IEclipsePreferences preferences = new EclipsePreferences(); diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/swt/properties/preference/EclipsePreferencesHandlerTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/swt/properties/preference/EclipsePreferencesHandlerTest.java index 1943449bba4..9cd12589817 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/swt/properties/preference/EclipsePreferencesHandlerTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/css/swt/properties/preference/EclipsePreferencesHandlerTest.java @@ -16,11 +16,11 @@ import static org.eclipse.e4.ui.css.swt.helpers.EclipsePreferencesHelper.PROPS_OVERRIDDEN_BY_CSS_PROP; import static org.eclipse.e4.ui.css.swt.properties.preference.EclipsePreferencesHandler.PREFERENCES_PROP; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; @@ -32,15 +32,15 @@ import org.eclipse.core.runtime.preferences.IEclipsePreferences; import org.eclipse.e4.ui.css.core.engine.CSSEngine; import org.eclipse.e4.ui.css.swt.dom.preference.EclipsePreferencesElement; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.w3c.dom.css.CSSValue; import org.w3c.dom.css.CSSValueList; public class EclipsePreferencesHandlerTest { @Test - public void testApplyCSSProperty() { + void testApplyCSSProperty() { // given CSSEngine engine = mock(CSSEngine.class); @@ -66,7 +66,7 @@ public void testApplyCSSProperty() { } @Test - public void testApplyCSSPropertyWhenCssValueList() { + void testApplyCSSPropertyWhenCssValueList() { // given CSSEngine engine = mock(CSSEngine.class); @@ -100,7 +100,7 @@ public void testApplyCSSPropertyWhenCssValueList() { } @Test - public void testOverridePropertyWithCSSValue() { + void testOverridePropertyWithCSSValue() { // given IEclipsePreferences preferences = new EclipsePreferences(); @@ -122,7 +122,7 @@ public void testOverridePropertyWithCSSValue() { } @Test - public void testOverridePropertyWithNameAndValueSplit() { + void testOverridePropertyWithNameAndValueSplit() { // given IEclipsePreferences preferences = new EclipsePreferences(); @@ -137,8 +137,8 @@ public void testOverridePropertyWithNameAndValueSplit() { } @Test - @Ignore("Failing on Hudson, see Bug 501875") - public void testOverridePropertyWithNameAndValueSplitAndNameAlreadyAddedByUser() { + @Disabled("Failing on Hudson, see Bug 501875") + void testOverridePropertyWithNameAndValueSplitAndNameAlreadyAddedByUser() { // given IEclipsePreferences preferences = new EclipsePreferences(); // pref is already set that means that user has overridden it with the @@ -156,7 +156,7 @@ public void testOverridePropertyWithNameAndValueSplitAndNameAlreadyAddedByUser() } @Test - public void testCustomizePreferenceOverriddenByCSS() { + void testCustomizePreferenceOverriddenByCSS() { // given IEclipsePreferences preferences = new EclipsePreferences(); diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/CssSwtTestSuite.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/CssSwtTestSuite.java index d9eeaf79d2e..23253c66dd2 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/CssSwtTestSuite.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/CssSwtTestSuite.java @@ -55,51 +55,21 @@ import org.eclipse.e4.ui.tests.css.swt.ThemesExtensionTest; import org.eclipse.e4.ui.tests.css.swt.ToolItemTest; import org.eclipse.e4.ui.tests.css.swt.TreeTest; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; +import org.junit.platform.suite.api.SelectClasses; +import org.junit.platform.suite.api.Suite; -// note to contributors: please ignore Eclipse default formatting and keep one class per line. -@RunWith(Suite.class) -@Suite.SuiteClasses({ - CSSSWTFontHelperTest.class, - CSSSWTColorHelperTest.class, - CSSResourcesHelpersTest.class, - SWTResourceRegistryKeyFactoryTest.class, - SWTResourcesRegistryTest.class, - FontDefinitionTest.class, - ColorDefinitionTest.class, - ThemesExtensionTest.class, - IEclipsePreferencesTest.class, - EclipsePreferencesHelperTest.class, - CSSSWTWidgetTest.class, - LabelTest.class, - LinkTest.class, - CTabFolderTest.class, - CTabItemTest.class, - IdClassLabelColorTest.class, - ShellTest.class, - ButtonTest.class, - ToolItemTest.class, - GradientTest.class, - MarginTest.class, - InnerClassElementTest.class, - EclipsePreferencesHandlerTest.class, - PreferenceOverriddenByCssChangeListenerTest.class, - ButtonTextTransformTest.class, - LabelTextTransformTest.class, - TextTextTransformTest.class, - DescendentTest.class, - ThemeTest.class, - Bug459961Test.class, - Bug419482Test.class, - ShellActiveTest.class, - InheritTest.class, - TableTest.class, - TreeTest.class, - TabbedPropertiesListTest.class, - TabbedPropertiesTitleTest.class, - ExpandableCompositeTest.class, - SectionTest.class}) +@Suite +@SelectClasses({ CSSSWTFontHelperTest.class, CSSSWTColorHelperTest.class, CSSResourcesHelpersTest.class, + SWTResourceRegistryKeyFactoryTest.class, SWTResourcesRegistryTest.class, FontDefinitionTest.class, + ColorDefinitionTest.class, ThemesExtensionTest.class, IEclipsePreferencesTest.class, + EclipsePreferencesHelperTest.class, CSSSWTWidgetTest.class, LabelTest.class, LinkTest.class, + CTabFolderTest.class, CTabItemTest.class, IdClassLabelColorTest.class, ShellTest.class, ButtonTest.class, + ToolItemTest.class, GradientTest.class, MarginTest.class, InnerClassElementTest.class, + EclipsePreferencesHandlerTest.class, PreferenceOverriddenByCssChangeListenerTest.class, + ButtonTextTransformTest.class, LabelTextTransformTest.class, TextTextTransformTest.class, DescendentTest.class, + ThemeTest.class, Bug459961Test.class, Bug419482Test.class, ShellActiveTest.class, InheritTest.class, + TableTest.class, TreeTest.class, TabbedPropertiesListTest.class, TabbedPropertiesTitleTest.class, + ExpandableCompositeTest.class, SectionTest.class }) public class CssSwtTestSuite { } diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/forms/ExpandableCompositeTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/forms/ExpandableCompositeTest.java index a80acb563dd..84a26ad3151 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/forms/ExpandableCompositeTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/forms/ExpandableCompositeTest.java @@ -13,9 +13,9 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.forms; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import org.eclipse.e4.ui.tests.css.swt.CSSSWTTestCase; import org.eclipse.swt.SWT; @@ -25,7 +25,7 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.forms.widgets.ExpandableComposite; import org.eclipse.ui.forms.widgets.ToggleHyperlink; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ExpandableCompositeTest extends CSSSWTTestCase { @@ -56,7 +56,7 @@ protected ExpandableComposite createTestExpandableComposite(String styleSheet) { } @Test - public void testExpandableCompositeColor() { + void testExpandableCompositeColor() { ExpandableComposite compositeToTest = createTestExpandableComposite( "ExpandableComposite { swt-titlebar-color: #FF0000; tb-toggle-color: #FF0000; tb-toggle-hover-color: #00FF00}"); assertNotNull(compositeToTest.getTitleBarForeground()); @@ -70,7 +70,7 @@ public void testExpandableCompositeColor() { } @Test - public void testExpandableComposite_foregroundColorGetsReset_foregroundCollorIsNull() throws Exception { + void testExpandableComposite_foregroundColorGetsReset_foregroundCollorIsNull() throws Exception { ExpandableComposite compositeToTest = createTestExpandableComposite( "ExpandableComposite { swt-titlebar-color: #FF0000; tb-toggle-color: #FF0000; tb-toggle-hover-color: #00FF00}"); assertNotNull(compositeToTest.getTitleBarForeground()); diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/forms/SectionTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/forms/SectionTest.java index a519fc0d42e..2488370c8f0 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/forms/SectionTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/forms/SectionTest.java @@ -14,9 +14,9 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.forms; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import org.eclipse.e4.ui.tests.css.swt.CSSSWTTestCase; import org.eclipse.swt.SWT; @@ -26,7 +26,7 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.forms.widgets.Section; import org.eclipse.ui.forms.widgets.ToggleHyperlink; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class SectionTest extends CSSSWTTestCase { @@ -54,7 +54,7 @@ protected Section createTestSection(String styleSheet) { } @Test - public void testSectionColors() { + void testSectionColors() { Section section = createTestSection( "Section { swt-titlebar-color: #FF0000;" + "tb-toggle-color: #FF0000; " + "tb-toggle-hover-color: #00FF00; " + "background-color-gradient-titlebar: #00FF00; " @@ -76,7 +76,7 @@ public void testSectionColors() { } @Test - public void testSectionResetColors() throws Exception { + void testSectionResetColors() throws Exception { Section section = createTestSection( "Section { swt-titlebar-color: #FF0000;" + "tb-toggle-color: #FF0000; " + "tb-toggle-hover-color: #00FF00; " + "background-color-gradient-titlebar: #00FF00; " diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/properties/tabbed/TabbedPropertiesListTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/properties/tabbed/TabbedPropertiesListTest.java index 2df430f9df6..d21683db054 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/properties/tabbed/TabbedPropertiesListTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/properties/tabbed/TabbedPropertiesListTest.java @@ -11,7 +11,7 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.properties.tabbed; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.e4.ui.tests.css.swt.CSSSWTTestCase; import org.eclipse.swt.SWT; @@ -21,7 +21,7 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyList; import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class TabbedPropertiesListTest extends CSSSWTTestCase { @@ -54,7 +54,7 @@ private TabbedPropertyList createTabbedPropertiesList(String stylesheet) { } @Test - public void colorsAreStyled() { + void colorsAreStyled() { TabbedPropertyList list = createTabbedPropertiesList(null); engine.applyStyles(shell, true); @@ -67,7 +67,7 @@ public void colorsAreStyled() { } @Test - public void colorsAreStyledAndReset() { + void colorsAreStyledAndReset() { TabbedPropertyList list = createTabbedPropertiesList(null); RGB colorListBackgroundBeforeStyling = list.getListBackgroundColor().getRGB(); @@ -86,7 +86,7 @@ public void colorsAreStyledAndReset() { } @Test - public void colorsAreNotChangedWhenNoStyleGivenInCss() { + void colorsAreNotChangedWhenNoStyleGivenInCss() { TabbedPropertyList list = createTabbedPropertiesList( "SomeOtherWidget { listBackground-color: #FF0000; widgetBackground-color: #FF0000; widgetNormalShadow-color: #FF0000; widgetDarkShadow-color: #FF0000; widgetForeground-color: #FF0000;}"); diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/properties/tabbed/TabbedPropertiesTitleTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/properties/tabbed/TabbedPropertiesTitleTest.java index 93304fa58bd..231bdbf8895 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/properties/tabbed/TabbedPropertiesTitleTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/properties/tabbed/TabbedPropertiesTitleTest.java @@ -11,8 +11,8 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.properties.tabbed; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import org.eclipse.e4.ui.tests.css.swt.CSSSWTTestCase; import org.eclipse.swt.SWT; @@ -23,7 +23,7 @@ import org.eclipse.ui.forms.IFormColors; import org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyTitle; import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class TabbedPropertiesTitleTest extends CSSSWTTestCase { @@ -63,7 +63,7 @@ private void assertColor(RGB expected, String actualKey){ } @Test - public void titleBackgroundColorIsStyled() { + void titleBackgroundColorIsStyled() { createTabbedPropertiesTitle(null); engine.applyStyles(shell, true); @@ -75,7 +75,7 @@ public void titleBackgroundColorIsStyled() { } @Test - public void titleBackgroundColorIsStyledAndReset() { + void titleBackgroundColorIsStyledAndReset() { createTabbedPropertiesTitle(null); RGB colorGradStartBeforStyling = factory.getColors().getColor(IFormColors.H_GRADIENT_START).getRGB(); @@ -92,7 +92,7 @@ public void titleBackgroundColorIsStyledAndReset() { } @Test - public void colorsAreNotChangedWhenNoStyleGivenInCss() { + void colorsAreNotChangedWhenNoStyleGivenInCss() { createTabbedPropertiesTitle( "SomeOtherWidget { h-gradient-start-color: #FF0000; h-gradient-end-color: #FF0000; h-bottom-keyline-1-color: #FF0000; h-bottom-keyline-2-color: #FF0000;}"); diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/Bug419482Test.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/Bug419482Test.java index c15a03113a5..4f7b3c4e29d 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/Bug419482Test.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/Bug419482Test.java @@ -14,7 +14,7 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.swt; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.RGB; @@ -24,7 +24,7 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.ToolBar; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class Bug419482Test extends CSSSWTTestCase { @@ -36,7 +36,7 @@ public class Bug419482Test extends CSSSWTTestCase { private ToolBar toolbar3; @Test - public void testTwoLevelsWildcard() { + void testTwoLevelsWildcard() { String cssString = "Shell > * > * { color: red; } \n" + "Label { color: blue; }"; Label label = createTestLabel(cssString); @@ -46,7 +46,7 @@ public void testTwoLevelsWildcard() { } @Test - public void testOneLevelWildcardOneSpecific() { + void testOneLevelWildcardOneSpecific() { String cssString = "Shell > * > Label { color: red; } \n" + "Label { color: blue; }"; Label label = createTestLabel(cssString); @@ -56,7 +56,7 @@ public void testOneLevelWildcardOneSpecific() { } @Test - public void testDescendentsWildcard() { + void testDescendentsWildcard() { String cssString = "Shell * { color: red; } \n" + "Label { color: blue; }"; Label label = createTestLabel(cssString); @@ -66,7 +66,7 @@ public void testDescendentsWildcard() { } @Test - public void testDescendentsSpecific() { + void testDescendentsSpecific() { String cssString = "Shell Label { color: red; } \n" + "Label { color: blue; }"; Label label = createTestLabel(cssString); @@ -76,7 +76,7 @@ public void testDescendentsSpecific() { } @Test - public void testOriginalBugReport() { + void testOriginalBugReport() { String css = "Shell, Shell > *, Shell > * > * {\n" + " background-color: red;\n" + "}\n" + "ToolBar {\n" + " background-color: blue;\n" + "}"; @@ -93,7 +93,7 @@ public void testOriginalBugReport() { } @Test - public void testOriginalBugReportDifferentOrder() { + void testOriginalBugReportDifferentOrder() { String css = "ToolBar {\n" + " background-color: blue;\n" + "}" + "Shell, Shell > *, Shell > * > * {\n" + " background-color: red;\n" + "}\n"; diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/Bug459961Test.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/Bug459961Test.java index 104d13366ca..31df4aa802b 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/Bug459961Test.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/Bug459961Test.java @@ -13,42 +13,36 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.swt; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.RGBA; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class Bug459961Test extends CSSSWTTestCase { @Test - public void testRegularColorConstantReference() { + void testRegularColorConstantReference() { String cssString = "Label { background-color: COLOR-GREEN; }"; Label label = createTestLabel(cssString); RGBA expected = Display.getDefault().getSystemColor(SWT.COLOR_GREEN).getRGBA(); RGBA actual = label.getBackground().getRGBA(); - assertRGBAEquals(expected, actual); + assertEquals(expected, actual); } @Test - public void testTransparentColorConstantReference() { + void testTransparentColorConstantReference() { String cssString = "Label { background-color: COLOR-TRANSPARENT; }"; Label label = createTestLabel(cssString); RGBA expected = Display.getDefault().getSystemColor(SWT.COLOR_TRANSPARENT).getRGBA(); RGBA actual = label.getBackground().getRGBA(); - assertRGBAEquals(expected, actual); + assertEquals(expected, actual); } - private void assertRGBAEquals(RGBA expected, RGBA actual) { - assertEquals(expected.rgb.red, actual.rgb.red); - assertEquals(expected.rgb.blue, actual.rgb.blue); - assertEquals(expected.rgb.green, actual.rgb.green); - assertEquals(expected.alpha, actual.alpha); - } } diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/ButtonTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/ButtonTest.java index 86d33290661..71fb362cfc1 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/ButtonTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/ButtonTest.java @@ -15,8 +15,8 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.swt; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.FontData; @@ -25,8 +25,8 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Shell; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; public class ButtonTest extends CSSSWTTestCase { @@ -52,14 +52,14 @@ protected Button createTestButton(String styleSheet, int buttonStyle) { } @Test - public void testColor() { + void testColor() { Button buttonToTest = createTestButton("Button { background-color: #FF0000; color: #0000FF }", SWT.CHECK); assertEquals(RED, buttonToTest.getBackground().getRGB()); assertEquals(BLUE, buttonToTest.getForeground().getRGB()); } @Test - public void testASpecificColor() { + void testASpecificColor() { // #054169 maps to RGB Decimal 5, 65, 105 see https://www.colorhexa.com/054169 var RGB_SPECIAL = new RGB(5, 65, 105); Button buttonToTest = createTestButton("Button { background-color: #054169; color: #054169; }", SWT.PUSH); @@ -68,7 +68,7 @@ public void testASpecificColor() { } @Test - public void testFontRegular() { + void testFontRegular() { Button buttonToTest = createTestButton("Button { font: Verdana 16px }", SWT.CHECK); assertEquals(1, buttonToTest.getFont().getFontData().length); FontData fontData = buttonToTest.getFont().getFontData()[0]; @@ -78,7 +78,7 @@ public void testFontRegular() { } @Test - public void testFontBold() { + void testFontBold() { Button buttonToTest = createTestButton("Button { font: Arial 12px; font-weight: bold }", SWT.CHECK); assertEquals(1, buttonToTest.getFont().getFontData().length); FontData fontData = buttonToTest.getFont().getFontData()[0]; @@ -88,15 +88,16 @@ public void testFontBold() { } @Test - public void testFontItalic() { + void testFontItalic() { Button buttonToTest = createTestButton("Button { font-style: italic }", SWT.CHECK); assertEquals(1, buttonToTest.getFont().getFontData().length); FontData fontData = buttonToTest.getFont().getFontData()[0]; assertEquals(SWT.ITALIC, fontData.getStyle()); } - @Ignore - public void testSelectedPseudo() { + @Disabled + @Test + void testSelectedPseudo() { Button buttonToTest = createTestButton("Button { color: #FF0000; }\n" + "Button:selected { color: #0000FF; }", SWT.CHECK); assertEquals(RED, buttonToTest.getForeground().getRGB()); @@ -106,7 +107,7 @@ public void testSelectedPseudo() { } @Test - public void testAlignment() { + void testAlignment() { Button buttonToTest = createTestButton("Button { swt-alignment: right; }", SWT.CHECK); assertEquals(SWT.RIGHT, buttonToTest.getAlignment()); @@ -118,7 +119,7 @@ public void testAlignment() { } @Test - public void testAlignment2() { + void testAlignment2() { Button buttonToTest = createTestButton("Button { swt-alignment: trail; }", SWT.CHECK); assertEquals(SWT.TRAIL, buttonToTest.getAlignment()); @@ -127,7 +128,7 @@ public void testAlignment2() { } @Test - public void testArrowAlignment() { + void testArrowAlignment() { Button buttonToTest = createTestButton("Button { swt-alignment: up; }", SWT.ARROW); assertEquals(SWT.UP, buttonToTest.getAlignment()); @@ -142,7 +143,7 @@ public void testArrowAlignment() { } @Test - public void ensurePseudoAttributeAllowsToSelectionPushButton() { + void ensurePseudoAttributeAllowsToSelectionPushButton() { Button buttonToTest = createTestButton("Button[style~='SWT.CHECK'] { background-color: #FF0000; color: #0000FF }", SWT.CHECK); assertEquals(RED, buttonToTest.getBackground().getRGB()); diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/CSSSWTTestCase.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/CSSSWTTestCase.java index a85c162d2e5..ebdada17265 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/CSSSWTTestCase.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/CSSSWTTestCase.java @@ -14,7 +14,7 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.swt; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.fail; import java.io.IOException; import java.io.StringReader; @@ -28,10 +28,8 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.rules.TestName; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; public class CSSSWTTestCase { static final RGB RED = new RGB(255, 0, 0); @@ -39,8 +37,6 @@ public class CSSSWTTestCase { static final RGB BLUE = new RGB(0, 0, 255); static final RGB WHITE = new RGB(255, 255, 255); - @Rule - public TestName testName = new TestName(); protected Display display; protected CSSEngine engine; @@ -59,12 +55,12 @@ public CSSEngine createEngine(String styleSheet, Display display) { } - @Before + @BeforeEach public void setUp() { display = Display.getDefault(); } - @After + @AfterEach public void tearDown() { if (!display.isDisposed()) { for (Shell shell : display.getShells()) { diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/CSSSWTWidgetTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/CSSSWTWidgetTest.java index cac91639267..859fbe4c00e 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/CSSSWTWidgetTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/CSSSWTWidgetTest.java @@ -14,10 +14,11 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.swt; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.function.Supplier; @@ -26,14 +27,11 @@ import org.eclipse.e4.ui.css.swt.dom.WidgetElement; import org.eclipse.e4.ui.css.swt.dom.html.SWTHTMLElement; import org.eclipse.swt.widgets.Widget; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; public class CSSSWTWidgetTest extends CSSSWTTestCase { - - - private static final class WidgetElementWithSupplierReturningNull extends WidgetElement { private WidgetElementWithSupplierReturningNull(Widget widget, CSSEngine engine) { super(widget, engine); @@ -60,15 +58,15 @@ private WidgetElementWithSwtStylesNull(Widget widget, CSSEngine engine) { } } - @Ignore + @Disabled @Test - public void testEngineKey() { + void testEngineKey() { Widget widget = createTestLabel("Label { font: Arial 12px; font-weight: bold }"); assertEquals(WidgetElement.getEngine(widget), engine); } @Test - public void testIDKey() { + void testIDKey() { final String id = "some.test.id"; Widget widget = createTestLabel("Label { font: Arial 12px; font-weight: bold }"); WidgetElement.setID(widget, id); @@ -77,7 +75,7 @@ public void testIDKey() { @Test - public void testCSSClassKey() { + void testCSSClassKey() { final String cssClass = "some.test.cssclassname"; Widget widget = createTestLabel("Label { font: Arial 12px; font-weight: bold }"); WidgetElement.setCSSClass(widget, cssClass); @@ -85,7 +83,7 @@ public void testCSSClassKey() { } @Test - public void testHasAttribute() { + void testHasAttribute() { Widget widget = createTestLabel("Label { }"); String propertySetToEmptyStringKey = "empty-property"; widget.setData(propertySetToEmptyStringKey, ""); @@ -95,7 +93,7 @@ public void testHasAttribute() { } @Test - public void testGetAttributeWithSwtStylesNull() { + void testGetAttributeWithSwtStylesNull() { Widget widget = createTestLabel("Label { }"); engine.setElementProvider((element, engine) -> new WidgetElementWithSwtStylesNull((Widget) element, engine)); @@ -104,7 +102,7 @@ public void testGetAttributeWithSwtStylesNull() { } @Test - public void testGetAttributeWithAttributeTypeNull() { + void testGetAttributeWithAttributeTypeNull() { Widget widget = createTestLabel("Label { }"); engine.setElementProvider( (element, engine) -> new SWTHTMLElementWithAttributeTypeNull((Widget) element, engine)); @@ -113,14 +111,14 @@ public void testGetAttributeWithAttributeTypeNull() { assertEquals("", engine.getElement(widget).getAttribute("type")); } - @Test(expected = AssertionFailedException.class) - public void testGetAttributeWithAttributeSupplierReturningNull() { + @Test + void testGetAttributeWithAttributeSupplierReturningNull() { Widget widget = createTestLabel("Label { }"); engine.setElementProvider( (element, engine) -> new WidgetElementWithSupplierReturningNull((Widget) element, engine)); // throws exception - engine.getElement(widget).getAttribute("style"); + assertThrows(AssertionFailedException.class, () -> engine.getElement(widget).getAttribute("style")); } } diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/CTabFolderTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/CTabFolderTest.java index 66078903b8f..ec7703696f7 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/CTabFolderTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/CTabFolderTest.java @@ -15,8 +15,8 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.swt; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotSame; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotSame; import org.eclipse.e4.ui.css.swt.dom.CTabFolderElement; import org.eclipse.swt.SWT; @@ -29,7 +29,7 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.ToolBar; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class CTabFolderTest extends CSSSWTTestCase { @@ -126,13 +126,13 @@ protected Label createLabelInCTabFolder(String styleSheet) { } @Test - public void testBackgroundColor() { + void testBackgroundColor() { CTabFolder folderToTest = createTestCTabFolder("CTabFolder { background-color: #0000FF }"); assertEquals(BLUE, folderToTest.getBackground().getRGB()); } @Test - public void testTextColor() { + void testTextColor() { CTabFolder folderToTest = createTestCTabFolder("CTabFolder { color: #0000FF }"); assertEquals(BLUE, folderToTest.getForeground().getRGB()); } @@ -140,7 +140,7 @@ public void testTextColor() { //See GradientTest for testing background gradient @Test - public void testFontRegular() { + void testFontRegular() { CTabFolder folderToTest = createTestCTabFolder("CTabFolder { font: Verdana 16px }"); assertEquals(1, folderToTest.getFont().getFontData().length); FontData fontData = folderToTest.getFont().getFontData()[0]; @@ -150,7 +150,7 @@ public void testFontRegular() { } @Test - public void testFontBold() { + void testFontBold() { CTabFolder folderToTest = createTestCTabFolder("CTabFolder { font: Arial 12px; font-weight: bold }"); assertEquals(1, folderToTest.getFont().getFontData().length); FontData fontData = folderToTest.getFont().getFontData()[0]; @@ -160,7 +160,7 @@ public void testFontBold() { } @Test - public void testFontItalic() { + void testFontItalic() { CTabFolder folderToTest = createTestCTabFolder("CTabFolder { font: Arial 12px; font-style: italic }"); assertEquals(1, folderToTest.getFont().getFontData().length); FontData fontData = folderToTest.getFont().getFontData()[0]; @@ -170,7 +170,7 @@ public void testFontItalic() { } @Test - public void testBorderVisible() { + void testBorderVisible() { CTabFolder folderToTest = createTestCTabFolder("CTabFolder { border-visible: true}"); assertEquals(true, folderToTest.getBorderVisible()); assertEquals("true", engine.retrieveCSSProperty(folderToTest, "border-visible", null)); @@ -180,7 +180,7 @@ public void testBorderVisible() { assertEquals("false", engine.retrieveCSSProperty(folderToTest, "border-visible", null)); } @Test - public void testSimple() { + void testSimple() { CTabFolder folderToTest = createTestCTabFolder("CTabFolder { swt-simple: true}"); assertEquals(true, folderToTest.getSimple()); assertEquals("true", engine.retrieveCSSProperty(folderToTest, "swt-simple", null)); @@ -191,7 +191,7 @@ public void testSimple() { } @Test - public void testMaximizeVisible() { + void testMaximizeVisible() { CTabFolder folderToTest = createTestCTabFolder("CTabFolder { swt-maximize-visible: true}"); assertEquals(true, folderToTest.getMaximizeVisible()); assertEquals("true", engine.retrieveCSSProperty(folderToTest, "swt-maximize-visible", null)); @@ -202,7 +202,7 @@ public void testMaximizeVisible() { } @Test - public void testMinimizeVisible() { + void testMinimizeVisible() { CTabFolder folderToTest = createTestCTabFolder("CTabFolder { swt-minimize-visible: true}"); assertEquals(true, folderToTest.getMinimizeVisible()); assertEquals("true", engine.retrieveCSSProperty(folderToTest, "swt-minimize-visible", null)); @@ -213,7 +213,7 @@ public void testMinimizeVisible() { } @Test - public void testMaximized() { + void testMaximized() { CTabFolder folderToTest = createTestCTabFolder("CTabFolder { swt-maximized: true}"); assertEquals(true, folderToTest.getMaximized()); assertEquals("true", engine.retrieveCSSProperty(folderToTest, "swt-maximized", null)); @@ -223,7 +223,7 @@ public void testMaximized() { } @Test - public void testMinimized() { + void testMinimized() { CTabFolder folderToTest = createTestCTabFolder("CTabFolder { swt-minimized: true}"); assertEquals(true, folderToTest.getMinimized()); assertEquals("true", engine.retrieveCSSProperty(folderToTest, "swt-minimized", null)); @@ -233,7 +233,7 @@ public void testMinimized() { } @Test - public void testTabHeight() { + void testTabHeight() { CTabFolder folderToTest = createTestCTabFolder("CTabFolder { swt-tab-height: 30px }"); assertEquals(30, folderToTest.getTabHeight()); folderToTest = createTestCTabFolder("CTabFolder { swt-tab-height: 40px }"); @@ -251,7 +251,7 @@ public void testTabHeight() { } @Test - public void testSingle() { + void testSingle() { CTabFolder folderToTest = createTestCTabFolder("CTabFolder { swt-single: true}"); assertEquals(true, folderToTest.getSingle()); assertEquals("true", engine.retrieveCSSProperty(folderToTest, "swt-single", null)); @@ -261,7 +261,7 @@ public void testSingle() { } @Test - public void testUnselectedCloseVisible() { + void testUnselectedCloseVisible() { CTabFolder folderToTest = createTestCTabFolder("CTabFolder { swt-unselected-close-visible true}"); assertEquals(true, folderToTest.getUnselectedCloseVisible()); assertEquals("true", engine.retrieveCSSProperty(folderToTest, "swt-unselected-close-visible", null)); @@ -271,7 +271,7 @@ public void testUnselectedCloseVisible() { } @Test - public void testUnselectedImageVisible() { + void testUnselectedImageVisible() { CTabFolder folderToTest = createTestCTabFolder("CTabFolder { swt-unselected-image-visible: true}"); assertEquals(true, folderToTest.getUnselectedImageVisible()); assertEquals("true", engine.retrieveCSSProperty(folderToTest, "swt-unselected-image-visible", null)); @@ -281,7 +281,7 @@ public void testUnselectedImageVisible() { } @Test - public void testRetrievePropertyNull() { + void testRetrievePropertyNull() { Shell shell = createShell("Shell {color:red}"); assertEquals(null, engine.retrieveCSSProperty(shell, "border-visible", null)); assertEquals(null, engine.retrieveCSSProperty(shell, "swt-maximized", null)); @@ -295,7 +295,7 @@ public void testRetrievePropertyNull() { } @Test - public void testTopRightAsDescendentChild() { + void testTopRightAsDescendentChild() { ToolBar[] toolBars = createTestToolBars( "CTabFolder.special ToolBar { background: #FF0000}\n" + "CTabFolder ToolBar { background: #00FF00}\n" + @@ -320,7 +320,7 @@ public void testTopRightAsDescendentChild() { } @Test - public void testStyleLabelChildInCTabFolder() { + void testStyleLabelChildInCTabFolder() { Label labelToTest = createLabelInCTabFolder("Label { background-color: #0000FF; }\n"); assertEquals(BLUE, labelToTest.getBackground().getRGB()); } diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/CTabItemTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/CTabItemTest.java index dfe2a8986e3..3ca0b08d65e 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/CTabItemTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/CTabItemTest.java @@ -14,11 +14,11 @@ ******************************************************************************/ package org.eclipse.e4.ui.tests.css.swt; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.e4.ui.css.core.engine.CSSEngine; import org.eclipse.e4.ui.css.swt.dom.CTabItemElement; @@ -34,9 +34,9 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Shell; -import org.junit.After; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; public class CTabItemTest extends CSSSWTTestCase { @@ -44,7 +44,7 @@ public class CTabItemTest extends CSSSWTTestCase { private Shell shell; @Override - @After + @AfterEach public void tearDown() { if (shell != null) { shell.dispose(); @@ -115,7 +115,7 @@ protected CTabFolder createTestTabFolder(String styleSheet, boolean open) { } @Test - public void testFontRegular() { + void testFontRegular() { CTabFolder folder = createTestTabFolder("Button { font-family: Verdana; font-size: 12 }\n" + "CTabItem { font-family: Verdana; font-size: 16 }"); spinEventLoop(); @@ -140,7 +140,7 @@ public void testFontRegular() { } @Test - public void testFontBold() { + void testFontBold() { CTabFolder folder = createTestTabFolder("Button { font-weight: bold }\n" + "CTabItem { font-weight: bold }"); spinEventLoop(); @@ -162,7 +162,7 @@ public void testFontBold() { } @Test - public void testFontItalic() { + void testFontItalic() { CTabFolder folder = createTestTabFolder("Button { font-weight: bold }\n" + "CTabItem { font-style: italic }"); spinEventLoop(); @@ -197,7 +197,7 @@ private void testSelectedFontBold(CTabFolder folder, int selectionIndex) { } @Test - public void testSelectedFontBold() { + void testSelectedFontBold() { CTabFolder folder = createTestTabFolder("CTabItem:selected { font-weight: bold }"); spinEventLoop(); for (int i = 0; i < folder.getItemCount(); i++) { @@ -206,7 +206,7 @@ public void testSelectedFontBold() { } @Test - public void testSelectedFontMerged() { + void testSelectedFontMerged() { CTabFolder folder = createTestTabFolder("CTabItem { font-weight: normal; font-style: italic }\n" + "CTabItem:selected { font-weight: bold }"); spinEventLoop(); @@ -222,7 +222,7 @@ public void testSelectedFontMerged() { } @Test - public void testSelectedFontMerged2() { + void testSelectedFontMerged2() { CTabFolder folder = createTestTabFolder("CTabItem { font-style: italic }\n" + "CTabItem:selected { font-weight: bold }"); spinEventLoop(); @@ -238,7 +238,7 @@ public void testSelectedFontMerged2() { } @Test - public void testSelectedFontMerged3() { + void testSelectedFontMerged3() { CTabFolder folder = createTestTabFolder("CTabItem { font-weight: bold }\n" + "CTabItem:selected { font-style: italic; font-weight: normal }"); spinEventLoop(); @@ -265,17 +265,17 @@ private void testShowClose(boolean showClose) { } @Test - public void testShowCloseFalse() { + void testShowCloseFalse() { testShowClose(false); } @Test - public void testShowCloseTrue() { + void testShowCloseTrue() { testShowClose(true); } @Test - public void testShowClose() { + void testShowClose() { CTabFolder folder = createTestTabFolder("CTabItem { show-close: true }"); for (int i = 0; i < folder.getItemCount(); i++) { assertEquals(true, folder.getItem(i).getShowClose()); @@ -290,7 +290,7 @@ public void testShowClose() { } @Test - public void testShowClose2() { + void testShowClose2() { CTabFolder folder = createTestTabFolder(); CTabFolder folder2 = createFolder(folder.getShell()); engine = createEngine("CTabItem { swt-show-close: true }", folder @@ -334,7 +334,7 @@ private void testSelectedShowClose(CTabFolder folder, int index) { } @Test - public void testSelectedShowClose() { + void testSelectedShowClose() { CTabFolder folder = createTestTabFolder("CTabItem:selected { show-close: true }"); for (int i = 0; i < folder.getItemCount(); i++) { testSelectedShowClose(folder, i); @@ -348,7 +348,7 @@ public void testSelectedShowClose() { } @Test - public void testSelectedShowClose2() { + void testSelectedShowClose2() { CTabFolder folder = createTestTabFolder("CTabItem { show-close: false }\n" + "CTabItem:selected { show-close: true }"); for (int i = 0; i < folder.getItemCount(); i++) { @@ -356,9 +356,9 @@ public void testSelectedShowClose2() { } } - @Ignore("test was commented before bug 443094") + @Disabled("test was commented before bug 443094") @Test - public void testClassSelectedShowClose() { + void testClassSelectedShowClose() { CTabFolder folder = createTestTabFolder(); WidgetElement.setCSSClass(folder, "editorStack"); @@ -370,9 +370,9 @@ public void testClassSelectedShowClose() { } } - @Ignore("test was commented before bug 443094") + @Disabled("test was commented before bug 443094") @Test - public void testFontsEditorStackClass() { + void testFontsEditorStackClass() { CTabFolder folder = createTestTabFolder(false); CTabFolder folder2 = createFolder(folder.getShell()); @@ -427,9 +427,9 @@ public void testFontsEditorStackClass() { } } - @Ignore("test was commented before bug 443094") + @Disabled("test was commented before bug 443094") @Test - public void testFontsEditorStackClass2() { + void testFontsEditorStackClass2() { CTabFolder folder = createTestTabFolder(false); CTabFolder folder2 = createFolder(folder.getShell()); @@ -487,9 +487,9 @@ public void testFontsEditorStackClass2() { } } - @Ignore("test was commented before bug 443094") + @Disabled("test was commented before bug 443094") @Test - public void testShowCloseEditorStack() { + void testShowCloseEditorStack() { CTabFolder folder = createTestTabFolder(false); CTabFolder folder2 = createFolder(folder.getShell()); @@ -529,9 +529,9 @@ public void testShowCloseEditorStack() { } } - @Ignore("test was commented before bug 443094") + @Disabled("test was commented before bug 443094") @Test - public void testShowCloseViewStack() { + void testShowCloseViewStack() { CTabFolder folder = createTestTabFolder(false); CTabFolder folder2 = createFolder(folder.getShell()); @@ -577,7 +577,7 @@ public void testShowCloseViewStack() { } @Test - public void testBackground() { + void testBackground() { CTabFolder folder = createTestTabFolder("CTabItem { background-color: #0000ff }", false); assertEquals(new RGB(0, 0, 255), folder.getBackground().getRGB()); @@ -587,7 +587,7 @@ public void testBackground() { } @Test - public void testBackground2() { + void testBackground2() { CTabFolder folder = createTestTabFolder(false); Color preStyledSelectionBackground = folder.getSelectionBackground(); @@ -613,7 +613,7 @@ public void testBackground2() { } @Test - public void testSelectionBackground() { + void testSelectionBackground() { CTabFolder folder = createTestTabFolder("CTabItem:selected { background-color: #00ff00 }", false); assertEquals(new RGB(0, 255, 0), folder.getSelectionBackground().getRGB()); @@ -623,7 +623,7 @@ public void testSelectionBackground() { } @Test - public void testForeground() { + void testForeground() { CTabFolder folder = createTestTabFolder("CTabItem { color: #0000ff }", false); assertEquals(new RGB(0, 0, 255), folder.getForeground().getRGB()); @@ -633,7 +633,7 @@ public void testForeground() { } @Test - public void testForeground2() { + void testForeground2() { CTabFolder folder = createTestTabFolder(false); Color preStyledSelectionForeground = folder.getSelectionForeground(); @@ -660,7 +660,7 @@ public void testForeground2() { } @Test - public void testSelectionForeground() { + void testSelectionForeground() { CTabFolder folder = createTestTabFolder("CTabItem:selected { color: #00ff00 }", false); assertEquals(new RGB(0, 255, 0), folder.getSelectionForeground().getRGB()); @@ -670,7 +670,7 @@ public void testSelectionForeground() { } @Test - public void testParent() { + void testParent() { CTabFolder folder = createTestTabFolder("CTabItem:selected { color: #00ff00 }", false); for (int i = 0; i < folder.getItemCount(); i++) { CTabItemElement element = (CTabItemElement) engine.getElement(folder.getItem(i)); diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/ColorDefinitionTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/ColorDefinitionTest.java index bb81f067540..b4d87457817 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/ColorDefinitionTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/ColorDefinitionTest.java @@ -14,10 +14,10 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.swt; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; @@ -32,14 +32,14 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.internal.themes.ColorDefinition; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.osgi.framework.FrameworkUtil; public class ColorDefinitionTest extends CSSSWTTestCase { @Test - public void testColorDefinition() { + void testColorDefinition() { //given CSSEngine engine = createEngine("ColorDefinition#ACTIVE_HYPERLINK_COLOR{color: green}", display); ColorDefinition definition = colorDefinition("ACTIVE_HYPERLINK_COLOR", "name", "categoryId", "description"); @@ -60,7 +60,7 @@ public void testColorDefinition() { } @Test - public void testColorDefinitionWhenNameCategoryIdAndDescriptionOverridden() { + void testColorDefinitionWhenNameCategoryIdAndDescriptionOverridden() { // given CSSEngine engine = createEngine("ColorDefinition#ACTIVE_HYPERLINK_COLOR{color: green;" + "label:'nameOverridden'; category:'#categoryIdOverridden'; description: 'descriptionOverridden'}", display); @@ -82,7 +82,7 @@ public void testColorDefinitionWhenNameCategoryIdAndDescriptionOverridden() { } @Test - public void testColorDefinitionWhenDefinitionStylesheetNotFound() { + void testColorDefinitionWhenDefinitionStylesheetNotFound() { //given CSSEngine engine = createEngine("ColorDefinition#ACTIVE_HYPERLINK_COLOR{color: green}", display); ColorDefinition definition = colorDefinition("color definition uniqueId without matching stylesheet", @@ -101,7 +101,7 @@ public void testColorDefinitionWhenDefinitionStylesheetNotFound() { } @Test - public void testWidgetWithColorDefinitionAsBackgroundColor() { + void testWidgetWithColorDefinitionAsBackgroundColor() { //given registerColorProviderWith("ACTIVE_HYPERLINK_COLOR", new RGB(255, 0, 0)); @@ -122,7 +122,7 @@ public void testWidgetWithColorDefinitionAsBackgroundColor() { } @Test - public void testUnset() { + void testUnset() { CSSEngine engine = createEngine("Button {background-color: unset;}", display); Shell shell = new Shell(display, SWT.SHELL_TRIM); @@ -145,7 +145,7 @@ public void testUnset() { } @Test - public void testSetColorDefinitionWithSystemColor() { + void testSetColorDefinitionWithSystemColor() { // given CSSEngine engine = createEngine("ColorDefinition#ACTIVE_HYPERLINK_COLOR{color: '#COLOR-LIST-SELECTION'}", display); diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/CompositeTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/CompositeTest.java index 9601f5980b5..e91bcc66707 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/CompositeTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/CompositeTest.java @@ -13,13 +13,13 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.swt; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Shell; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class CompositeTest extends CSSSWTTestCase { @@ -63,15 +63,14 @@ protected Composite createTestCompositeAsInnerClass(String styleSheet) { } @Test - public void testCompositeColor() { + void testCompositeColor() { Composite compositeToTest = createTestComposite("Composite { background-color: #FF0000; color: #0000FF }"); assertEquals(RED, compositeToTest.getBackground().getRGB()); assertEquals(BLUE, compositeToTest.getForeground().getRGB()); } @Test - - public void testCompositeAsInnerClass() { + void testCompositeAsInnerClass() { // for inner classes you to use OuterWidget-InnerWidget // see https://wiki.eclipse.org/Eclipse4/RCP/CSS Composite compositeToTest = createTestCompositeAsInnerClass( diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/DescendentTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/DescendentTest.java index 2b4c75df641..7464780c703 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/DescendentTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/DescendentTest.java @@ -14,7 +14,7 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.swt; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.e4.ui.css.swt.dom.WidgetElement; import org.eclipse.swt.SWT; @@ -23,7 +23,7 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Shell; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class DescendentTest extends CSSSWTTestCase { @@ -55,7 +55,7 @@ protected Button[] createTestWidgets(String styleSheet) { } @Test - public void testDescendentSpecificity() { + void testDescendentSpecificity() { Button[] buttons = createTestWidgets( "Composite.special Button { background: #FF0000}\n" + //specificity a=1 b=0 c=1 = 101 "Composite Button { background: #00FF00}\n" + //specificity a=0 b=0 c=2 = 002 diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/FontDefinitionTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/FontDefinitionTest.java index f14cbbe92e3..8295ca493d1 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/FontDefinitionTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/FontDefinitionTest.java @@ -14,11 +14,11 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.swt; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; @@ -31,15 +31,13 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.internal.themes.FontDefinition; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.osgi.framework.FrameworkUtil; public class FontDefinitionTest extends CSSSWTTestCase { - - @Test - public void testFontDefinition() { + void testFontDefinition() { //given engine = createEngine( "FontDefinition#org-eclipse-jface-bannerfont {font-family: 'Times';font-size: 12;font-style: italic;font-weight: bold;}", @@ -64,7 +62,7 @@ public void testFontDefinition() { } @Test - public void testFontDefinitionWhenNameCategoryIdAndDescriptionOverridden() { + void testFontDefinitionWhenNameCategoryIdAndDescriptionOverridden() { // given engine = createEngine( "FontDefinition#org-eclipse-jface-bannerfont {font-family: 'Times';font-size: 12;font-style: italic; font-weight: bold;" @@ -90,7 +88,7 @@ public void testFontDefinitionWhenNameCategoryIdAndDescriptionOverridden() { } @Test - public void testFontDefinitionWhenDefinitionStylesheetNotFound() { + void testFontDefinitionWhenDefinitionStylesheetNotFound() { //given engine = createEngine( "FontDefinition#org-eclipse-jface-bannerfont {font-family: 'Times';font-size: 12;font-style: italic;}", @@ -109,7 +107,7 @@ public void testFontDefinitionWhenDefinitionStylesheetNotFound() { } @Test - public void testWidgetWithFontDefinitionAsFontFamily() { + void testWidgetWithFontDefinitionAsFontFamily() { //given registerFontProviderWith("org.eclipse.jface.bannerfont", new FontData("Times", 12, SWT.ITALIC)); diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/GradientTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/GradientTest.java index a3a33152b21..1a81394ee24 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/GradientTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/GradientTest.java @@ -14,8 +14,8 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.swt; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.lang.reflect.Field; @@ -27,7 +27,7 @@ import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Shell; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Test gradient capabilities. @@ -64,7 +64,7 @@ protected CTabFolder createTestCTabFolder(String styleSheet) { } @Test - public void testGradients() { + void testGradients() { CTabFolder folderToTest = createTestCTabFolder( "CTabItem:selected { background-color: #FF0000 #0000FF}"); assertEquals(RED, getSelectionBackgroundBegin(folderToTest).getRGB()); //gradient begin @@ -72,7 +72,7 @@ public void testGradients() { } @Test - public void testDefaultPercents() { + void testDefaultPercents() { CTabFolder folderToTest = createTestCTabFolder( "CTabItem:selected { background-color: #FF0000 #0000FF}"); assertEquals(RED, getSelectionBackgroundBegin(folderToTest).getRGB()); //gradient begin @@ -82,7 +82,7 @@ public void testDefaultPercents() { } @Test - public void testDefaultManyPercents() { + void testDefaultManyPercents() { CTabFolder folderToTest = createTestCTabFolder( "CTabItem:selected { background-color: red green blue yellow}"); assertArrayEquals(new int[] { 33, 67, 100 }, getSelectionGradientPercents(folderToTest)); // default @@ -90,14 +90,14 @@ public void testDefaultManyPercents() { } @Test - public void testSpecifiedPercents() { + void testSpecifiedPercents() { CTabFolder folderToTest = createTestCTabFolder( "CTabItem:selected { background-color: #FF0000 #0000FF 53%}"); assertArrayEquals(new int[] { 53 }, getSelectionGradientPercents(folderToTest)); } @Test - public void testManyColorsAndSpecifiedManyPercents() { + void testManyColorsAndSpecifiedManyPercents() { CTabFolder folderToTest = createTestCTabFolder( "CTabItem:selected { background-color: #FF0000 #00FF00 #0000FF 22% 44%}"); assertEquals(RED, getSelectionBackgroundBegin(folderToTest).getRGB()); //gradient begin @@ -110,7 +110,7 @@ public void testManyColorsAndSpecifiedManyPercents() { * Tests handling when # of percents isn't one less than number of colors */ @Test - public void testBadPercents() { + void testBadPercents() { //There should be either zero or three percent declarations, otherwise it acts as default CTabFolder folderToTest = createTestCTabFolder( "CTabItem:selected { background-color: red green blue yellow 10%}"); @@ -123,7 +123,7 @@ public void testBadPercents() { * (non-existent color name is ignored) */ @Test - public void testBadColors() { + void testBadColors() { CTabFolder folderToTest = createTestCTabFolder( "CTabItem:selected { background-color: #FF0000 notAColor #0000FF}"); assertEquals(RED, getSelectionBackgroundBegin(folderToTest).getRGB()); //gradient begin @@ -136,7 +136,7 @@ public void testBadColors() { * Test to ensure that a percent > 100 triggers default */ @Test - public void testAboveRangePercents() { + void testAboveRangePercents() { CTabFolder folderToTest = createTestCTabFolder( "CTabItem:selected { background-color: #FF0000 #00FF00 #0000FF 20% 110%}"); assertEquals(RED, getSelectionBackgroundBegin(folderToTest).getRGB()); //gradient begin @@ -149,7 +149,7 @@ public void testAboveRangePercents() { * Test to ensure that a percent < 0 triggers default */ @Test - public void testBelowRangePercents() { + void testBelowRangePercents() { CTabFolder folderToTest = createTestCTabFolder( "CTabItem:selected { background-color: #FF0000 #00FF00 #0000FF -20% 50%}"); assertEquals(RED, getSelectionBackgroundBegin(folderToTest).getRGB()); //gradient begin @@ -166,7 +166,7 @@ public void testBelowRangePercents() { * 100%; */ @Test - public void testAltSyntax() { + void testAltSyntax() { CTabFolder folderToTest = createTestCTabFolder( "CTabItem:selected { background-color: gradient, rgb(140,140,140), rgb(48,48,48), 100%;"); assertEquals(new RGB(140,140,140), getSelectionBackgroundBegin(folderToTest).getRGB()); //gradient begin diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/IEclipsePreferencesTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/IEclipsePreferencesTest.java index cd75014cabb..cf71a54cbbd 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/IEclipsePreferencesTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/IEclipsePreferencesTest.java @@ -14,17 +14,16 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.swt; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.core.internal.preferences.EclipsePreferences; import org.eclipse.core.runtime.preferences.IEclipsePreferences; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class IEclipsePreferencesTest extends CSSSWTTestCase { - @Test - public void testIEclipsePreferences() { + void testIEclipsePreferences() { // given IEclipsePreferences preferences = new EclipsePreferences(null, "org.eclipse.jdt.ui") {}; diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/IdClassLabelColorTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/IdClassLabelColorTest.java index 080834b1586..d4e3ce0613a 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/IdClassLabelColorTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/IdClassLabelColorTest.java @@ -14,7 +14,7 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.swt; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.e4.ui.css.swt.dom.WidgetElement; import org.eclipse.swt.SWT; @@ -23,7 +23,7 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; -import org.junit.Test; +import org.junit.jupiter.api.Test; /* * Tests the CSS class and Id rules @@ -64,25 +64,25 @@ protected Label createTestLabel(String styleSheet) { //For completeness, test that the html type rule works @Test - public void testWidgetClass() { + void testWidgetClass() { Label label = createTestLabel("Label { background-color: #FF0000 }"); assertEquals(RED, label.getBackground().getRGB()); } //Test the CSS class rule @Test - public void testCssClass() { + void testCssClass() { Label labelToTest = createTestLabel("." + CSS_CLASS_NAME + " { background-color: #00FF00 }"); //Ensure the widget actually thinks it has this CSS class - assertEquals(WidgetElement.getCSSClass(labelToTest), CSS_CLASS_NAME); + assertEquals(CSS_CLASS_NAME, WidgetElement.getCSSClass(labelToTest)); assertEquals(GREEN, labelToTest.getBackground().getRGB()); } //Test the id rule @Test - public void testWidgetId() { + void testWidgetId() { Label labelToTest = createTestLabel("#" + CSS_ID + " { background-color: #0000FF }"); //Ensure the widget actually thinks it has this ID diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/InheritTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/InheritTest.java index 10e25b0d85d..aac8ba4e267 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/InheritTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/InheritTest.java @@ -14,7 +14,7 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.swt; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Color; @@ -23,8 +23,8 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class InheritTest extends CSSSWTTestCase { @@ -35,7 +35,7 @@ public class InheritTest extends CSSSWTTestCase { static final RGB BLUE = new RGB(0, 0, 255); static final RGB RED = new RGB(255, 0, 0); - @Before + @BeforeEach @Override public void setUp() { super.setUp(); @@ -50,7 +50,7 @@ public void setUp() { * backgound-color. */ @Test - public void testBackgroundNoInherit() { + void testBackgroundNoInherit() { Label labelToTest = createTestLabel( "Label { background-color: #00FF00; }\n" + "Composite Label { color: #0000FF; }", true); @@ -65,7 +65,7 @@ public void testBackgroundNoInherit() { * background-color of the parent widget. */ @Test - public void testBackgroundInherit() throws Exception { + void testBackgroundInherit() throws Exception { Label labelToTest = createTestLabel( "Label { background-color: #00FF00; }\n" + "Composite { background-color: #FF0000; } \n" @@ -82,7 +82,7 @@ public void testBackgroundInherit() throws Exception { * background-color of the parent widget. */ @Test - public void testBackgroundInheritsAlsoExplicitlySetColors() + void testBackgroundInheritsAlsoExplicitlySetColors() throws Exception { Label labelToTest = createTestLabel( "Label { background-color: #00FF00; }\n" diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/InnerClassElementTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/InnerClassElementTest.java index 1a78702f4e9..97dad6f0d6f 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/InnerClassElementTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/InnerClassElementTest.java @@ -15,14 +15,14 @@ package org.eclipse.e4.ui.tests.css.swt; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class InnerClassElementTest extends CSSSWTTestCase { @@ -56,7 +56,7 @@ protected Label createTestLabel(String styleSheet) { } @Test - public void testInnerClassElement() { + void testInnerClassElement() { Label label = createTestLabel("InnerClassElementTest-CustomComposite Label { color: #00ffa0; }"); assertEquals(0x00, label.getForeground().getRed()); diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/LabelTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/LabelTest.java index fe9e343aede..536fb97d03d 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/LabelTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/LabelTest.java @@ -15,25 +15,24 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.swt; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.widgets.Label; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class LabelTest extends CSSSWTTestCase { - @Test - public void testColor() { + void testColor() { Label labelToTest = createTestLabel("Label { background-color: #FF0000; color: #0000FF }"); assertEquals(RED, labelToTest.getBackground().getRGB()); assertEquals(BLUE, labelToTest.getForeground().getRGB()); } @Test - public void testFontRegular() { + void testFontRegular() { Label labelToTest = createTestLabel("Label { font: Verdana 16px }"); assertEquals(1, labelToTest.getFont().getFontData().length); FontData fontData = labelToTest.getFont().getFontData()[0]; @@ -43,7 +42,7 @@ public void testFontRegular() { } @Test - public void testFontBold() { + void testFontBold() { Label labelToTest = createTestLabel("Label { font: Arial 12px; font-weight: bold }"); assertEquals(1, labelToTest.getFont().getFontData().length); FontData fontData = labelToTest.getFont().getFontData()[0]; @@ -53,7 +52,7 @@ public void testFontBold() { } @Test - public void testFontItalic() { + void testFontItalic() { Label labelToTest = createTestLabel("Label { font-style: italic }"); assertEquals(1, labelToTest.getFont().getFontData().length); FontData fontData = labelToTest.getFont().getFontData()[0]; @@ -61,7 +60,7 @@ public void testFontItalic() { } @Test - public void testAlignment() { + void testAlignment() { Label labelToTest = createTestLabel("Label { swt-alignment: right }"); assertEquals(SWT.RIGHT, labelToTest.getAlignment()); @@ -74,7 +73,7 @@ public void testAlignment() { } @Test - public void testAlignment2() { + void testAlignment2() { Label labelToTest = createTestLabel("Label { swt-alignment: trail }"); assertEquals(SWT.TRAIL, labelToTest.getAlignment()); diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/LinkTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/LinkTest.java index f0182239dd9..141f8c3fa3e 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/LinkTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/LinkTest.java @@ -14,14 +14,14 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.swt; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Link; import org.eclipse.swt.widgets.Shell; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class LinkTest extends CSSSWTTestCase { @@ -47,7 +47,7 @@ private Link createTestLink(String styleSheet) { } @Test - public void testLinkColors() { + void testLinkColors() { Link widgetToTest = createTestLink( "Link { background-color: #FF0000; color: #00FF00; swt-link-foreground-color: #0000FF;}"); assertEquals(RED, widgetToTest.getBackground().getRGB()); diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/MarginTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/MarginTest.java index cbc89f9e80a..46a1bd98fb0 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/MarginTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/MarginTest.java @@ -14,8 +14,8 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.swt; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotSame; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotSame; import org.eclipse.e4.ui.css.swt.CSSSWTConstants; import org.eclipse.swt.SWT; @@ -25,7 +25,7 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Shell; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class MarginTest extends CSSSWTTestCase { @@ -113,7 +113,7 @@ protected Control createBadControlNoKey(String styleSheet) { } @Test - public void testTopMargin() { + void testTopMargin() { Control control = createTestControl("Button { margin-top: 10}"); assertEquals(10, getMargin(control, TOP)); assertEquals(0, getMargin(control, RIGHT)); @@ -122,7 +122,7 @@ public void testTopMargin() { } @Test - public void testRightMargin() { + void testRightMargin() { Control control = createTestControl("Button { margin-right: 20}"); assertEquals(0, getMargin(control, TOP)); assertEquals(20, getMargin(control, RIGHT)); @@ -131,7 +131,7 @@ public void testRightMargin() { } @Test - public void testBottomMargin() { + void testBottomMargin() { Control control = createTestControl("Button { margin-bottom: 30}"); assertEquals(0, getMargin(control, TOP)); assertEquals(0, getMargin(control, RIGHT)); @@ -140,7 +140,7 @@ public void testBottomMargin() { } @Test - public void testLeftMargin() { + void testLeftMargin() { Control control = createTestControl("Button { margin-left: 40}"); assertEquals(0, getMargin(control, TOP)); assertEquals(0, getMargin(control, RIGHT)); @@ -149,7 +149,7 @@ public void testLeftMargin() { } @Test - public void testMargin1Value() { + void testMargin1Value() { Control control = createTestControl("Button { margin: 15}"); assertEquals(15, getMargin(control, TOP)); assertEquals(15, getMargin(control, RIGHT)); @@ -158,7 +158,7 @@ public void testMargin1Value() { } @Test - public void testMargin2Values() { + void testMargin2Values() { Control control = createTestControl("Button { margin: 10 15}"); assertEquals(10, getMargin(control, TOP)); assertEquals(15, getMargin(control, RIGHT)); @@ -167,7 +167,7 @@ public void testMargin2Values() { } @Test - public void testMargin4Values() { + void testMargin4Values() { Control control = createTestControl("Button { margin: 10 15 20 40}"); assertEquals(10, getMargin(control, TOP)); assertEquals(15, getMargin(control, RIGHT)); @@ -179,7 +179,7 @@ public void testMargin4Values() { * Test handling if there is no layout on the control so can't set margins */ @Test - public void testMarginNoLayout() { + void testMarginNoLayout() { //shouldn't blow up, nothing should happen Control control = createBadControlNoLayout("Button { margin: 10 15 20 40; background-color: #FF0000 }"); //ensure that any styling after 'margin:' gets processed @@ -190,7 +190,7 @@ public void testMarginNoLayout() { * Test handling if there is no composite on the control so can't set margins */ @Test - public void testMarginNoComposite() { + void testMarginNoComposite() { //shouldn't blow up, nothing should happen Control control = createBadControlNoComposite("Button { margin: 10 15 20 40; background-color: #FF0000 }"); //ensure that any styling after 'margin:' gets processed @@ -201,7 +201,7 @@ public void testMarginNoComposite() { * Test handling if there is no key to tell us we can manipulate the composite's layout */ @Test - public void testMarginNoKey() { + void testMarginNoKey() { //shouldn't blow up, nothing should happen Control control = createBadControlNoKey("Button { margin: 10 15 20 40; background-color: #FF0000 }"); //ensure that any styling after 'margin:' gets processed diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/ShellActiveTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/ShellActiveTest.java index d26af1478e1..cceeb735a98 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/ShellActiveTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/ShellActiveTest.java @@ -14,15 +14,15 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.swt; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Shell; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; -@Ignore("see bug #273582") +@Disabled("see bug #273582") public class ShellActiveTest extends CSSSWTTestCase { static final RGB RED = new RGB(255, 0, 0); @@ -42,7 +42,7 @@ protected Shell createShell(String styleSheet) { } @Test - public void testShellActive() throws Exception { + void testShellActive() throws Exception { Shell shell = createShell("Shell:active {background-color: #FF0000;}\n" + "Shell {background-color: #0000FF;}"); assertEquals(RED, shell.getBackground().getRGB()); diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/ShellTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/ShellTest.java index 7190f754724..6566d761e29 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/ShellTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/ShellTest.java @@ -14,8 +14,8 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.swt; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotSame; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotSame; import java.util.HashSet; @@ -26,7 +26,7 @@ import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Shell; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ShellTest extends CSSSWTTestCase { @@ -54,14 +54,14 @@ protected Shell createTestShell(String styleSheet) { @Test - public void testColor() { + void testColor() { Shell shellToTest = createTestShell("Shell { background-color: #FF0000; color: #0000FF }"); assertEquals(RED, shellToTest.getBackground().getRGB()); assertEquals(BLUE, shellToTest.getForeground().getRGB()); } @Test - public void testFontRegular() { + void testFontRegular() { Shell shellToTest = createTestShell("Shell { font: Verdana 16px }"); assertEquals(1, shellToTest.getFont().getFontData().length); FontData fontData = shellToTest.getFont().getFontData()[0]; @@ -71,7 +71,7 @@ public void testFontRegular() { } @Test - public void testFontBold() { + void testFontBold() { Shell shellToTest = createTestShell("Shell { font: Arial 12px; font-weight: bold }"); assertEquals(1, shellToTest.getFont().getFontData().length); FontData fontData = shellToTest.getFont().getFontData()[0]; @@ -81,7 +81,7 @@ public void testFontBold() { } @Test - public void testFontItalic() { + void testFontItalic() { Shell shellToTest = createTestShell("Shell { font-style: italic }"); assertEquals(1, shellToTest.getFont().getFontData().length); FontData fontData = shellToTest.getFont().getFontData()[0]; @@ -90,7 +90,7 @@ public void testFontItalic() { // bug 375069: ensure children aren't caught up in parent @Test - public void test375069ChildShellDifferentiation() { + void test375069ChildShellDifferentiation() { engine = createEngine("Shell.parent { font-style: italic; }", display); Shell parent = new Shell(display, SWT.NONE); @@ -114,7 +114,7 @@ public void test375069ChildShellDifferentiation() { // bug 375069: ensure children shells are still captured by Shell @Test - public void test375069AllShell() { + void test375069AllShell() { engine = createEngine("Shell { font-style: italic; }", display); Shell parent = new Shell(display, SWT.NONE); @@ -137,7 +137,7 @@ public void test375069AllShell() { // bug 375069: ensure children shells are still captured by Shell @Test - public void testShellParentage() { + void testShellParentage() { engine = createEngine( "Shell[parentage='parent'] { font-style: italic; }", display); @@ -160,7 +160,7 @@ public void testShellParentage() { } @Test - public void testShellUnparentedPseudoelement() { + void testShellUnparentedPseudoelement() { engine = createEngine( "Shell:swt-unparented { font-style: italic; }", display); @@ -183,7 +183,7 @@ public void testShellUnparentedPseudoelement() { } @Test - public void testShellParentedPseudoelement() { + void testShellParentedPseudoelement() { engine = createEngine( "Shell:swt-parented { font-style: italic; }", display); @@ -206,7 +206,7 @@ public void testShellParentedPseudoelement() { } @Test - public void testSwtDataClassAttribute() { + void testSwtDataClassAttribute() { engine = createEngine( "Shell[swt-data-class ~= 'java.util.HashSet'] { font-style: italic; }", display); @@ -222,7 +222,7 @@ public void testSwtDataClassAttribute() { } @Test - public void testBackgroundMode() { + void testBackgroundMode() { Shell shellToTest = createTestShell("Shell { swt-background-mode: force; }"); assertEquals(SWT.INHERIT_FORCE, shellToTest.getBackgroundMode()); } diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/TableTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/TableTest.java index c534aaf878d..27d28631e47 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/TableTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/TableTest.java @@ -13,7 +13,7 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.swt; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.RGB; @@ -21,7 +21,7 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Table; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class TableTest extends CSSSWTTestCase { @@ -51,14 +51,14 @@ protected Table createTestTable(String styleSheet) { @Test - public void testTableColor() { + void testTableColor() { Table tableToTest = createTestTable("Table { background-color: #FF0000; color: #0000FF }"); assertEquals(RED, tableToTest.getBackground().getRGB()); assertEquals(BLUE, tableToTest.getForeground().getRGB()); } @Test - public void testTableHeaderColor() { + void testTableHeaderColor() { Table tableToTest = createTestTable( "Table { swt-header-background-color: #FF0000; swt-header-color: #0000FF }"); assertEquals(RED, tableToTest.getHeaderBackground().getRGB()); diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/TestPropertyHelper.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/TestPropertyHelper.java index 633dd17628b..2b40fc72ff3 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/TestPropertyHelper.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/TestPropertyHelper.java @@ -14,11 +14,10 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.swt; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.e4.ui.css.swt.helpers.PropertyHelper; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class TestPropertyHelper { public static class Base { @@ -64,37 +63,22 @@ public void setNested(Base nested) { } @Test - public void testReadWriteProperty() { + void testReadWriteProperty() throws Exception { Impl bean = new Impl(); - try { - assertEquals("A",PropertyHelper.getProperty(bean, "a")); - assertEquals("B",PropertyHelper.getProperty(bean, "b")); - } catch (Exception e) { - e.printStackTrace(); - fail(); - } + assertEquals("A",PropertyHelper.getProperty(bean, "a")); + assertEquals("B",PropertyHelper.getProperty(bean, "b")); } @Test - public void testReadOnlyProperty() { + void testReadOnlyProperty() throws Exception { Impl bean = new Impl(); - try { - assertEquals("C",PropertyHelper.getProperty(bean, "c")); - assertEquals(true,PropertyHelper.getProperty(bean, "d")); - } catch (Exception e) { - e.printStackTrace(); - fail(); - } + assertEquals("C",PropertyHelper.getProperty(bean, "c")); + assertEquals(true,PropertyHelper.getProperty(bean, "d")); } @Test - public void testNestedProperty() { + void testNestedProperty() throws Exception { Impl bean = new Impl(); - try { - assertEquals("Nested",PropertyHelper.getProperty(bean, "nested.a")); - } catch (Exception e) { - e.printStackTrace(); - fail(); - } + assertEquals("Nested",PropertyHelper.getProperty(bean, "nested.a")); } } diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/TextTransformTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/TextTransformTest.java index 782cc18802c..8d424adcc90 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/TextTransformTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/TextTransformTest.java @@ -14,14 +14,14 @@ ******************************************************************************/ package org.eclipse.e4.ui.tests.css.swt; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Shell; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Tests the text-transform property. diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/ThemeTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/ThemeTest.java index 250fb1312e5..83a5720c3e2 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/ThemeTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/ThemeTest.java @@ -14,9 +14,9 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.swt; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Dictionary; import java.util.Hashtable; @@ -26,9 +26,9 @@ import org.eclipse.e4.ui.css.swt.theme.IThemeEngine; import org.eclipse.e4.ui.css.swt.theme.IThemeManager; import org.eclipse.swt.widgets.Display; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.FrameworkUtil; @@ -43,26 +43,26 @@ public class ThemeTest extends CSSSWTTestCase { private ServiceReference themeManagerReference; @Override - @Before + @BeforeEach public void setUp() { super.setUp(); Bundle b = FrameworkUtil.getBundle(this.getClass()); - assertNotNull("Not running in an OSGi environment", b); + assertNotNull(b, "Not running in an OSGi environment"); context = b.getBundleContext(); - assertNotNull("Not running in an OSGi environment", b); + assertNotNull(b, "Not running in an OSGi environment"); themeManagerReference = context .getServiceReference(IThemeManager.class); } @Override - @After + @AfterEach public void tearDown() { themeListenerRegistration.unregister(); super.tearDown(); } @Test - public void testThemeChangeNotification() { + void testThemeChangeNotification() { // we don't call createEngine() as ThemeEngine creates its own engine final Display display = Display.getDefault(); @@ -90,7 +90,7 @@ public void testThemeChangeNotification() { private IThemeEngine getThemeEngine(Display display) { IThemeManager manager = context.getService(themeManagerReference); - assertNotNull("Theme manager service not available", manager); + assertNotNull(manager, "Theme manager service not available"); return manager.getEngineForDisplay(display); } diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/ThemesExtensionTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/ThemesExtensionTest.java index ff36212acdb..18c87560260 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/ThemesExtensionTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/ThemesExtensionTest.java @@ -14,25 +14,25 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.swt; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.ui.internal.themes.ColorDefinition; import org.eclipse.ui.internal.themes.FontDefinition; import org.eclipse.ui.internal.themes.ThemesExtension; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ThemesExtensionTest extends CSSSWTTestCase { @Test - public void testThemesExtension() { + void testThemesExtension() { //given engine = createEngine( "ThemesExtension {font-definition: '#org-eclipse-ui-workbench-FONT_DEF_1'," + - "'#org-eclipse-ui-workbench-FONT_DEF_2'; color-definition: '#org-eclipse-ui-workbench-COLOR_DEF_1';}", display); + "'#org-eclipse-ui-workbench-FONT_DEF_2'; color-definition: '#org-eclipse-ui-workbench-COLOR_DEF_1';}", display); ThemesExtension themesExtention = new ThemesExtension(); //when diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/ToolItemTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/ToolItemTest.java index 4fe91e3b930..56b11e7d9f6 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/ToolItemTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/ToolItemTest.java @@ -13,8 +13,8 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.swt; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FillLayout; @@ -22,8 +22,8 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.ToolBar; import org.eclipse.swt.widgets.ToolItem; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; public class ToolItemTest extends CSSSWTTestCase { @@ -51,21 +51,21 @@ protected ToolItem createTestToolItem(String styleSheet, int styleBit) { } @Test - public void testBackgroundColor() { + void testBackgroundColor() { var toolItemToTest = createTestToolItem("ToolItem { background-color: #FF0000;}", SWT.PUSH); assertEquals(RED, toolItemToTest.getBackground().getRGB()); } @Test - public void testForegroundColor() { + void testForegroundColor() { var toolItemToTest = createTestToolItem("ToolItem { color: #FF0000;}", SWT.PUSH); assertEquals(RED, toolItemToTest.getForeground().getRGB()); } @Test - @Ignore("Not yet implemented") - public void testSelectedPseudo() { + @Disabled("Not yet implemented") + void testSelectedPseudo() { var toolItemToTest = createTestToolItem( "ToolItem { color: #FF0000; }\n" + "ToolItem:checked { color: #0000FF; }", SWT.PUSH); assertEquals(RED, toolItemToTest.getForeground().getRGB()); @@ -75,7 +75,7 @@ public void testSelectedPseudo() { } @Test - public void ensurePseudoAttributeAllowsToSelectionPushButton() { + void ensurePseudoAttributeAllowsToSelectionPushButton() { var toolItemToTest = createTestToolItem( "ToolItem[style~='SWT.CHECK'] { background-color: #FF0000; color: #0000FF }", SWT.CHECK); diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/TreeTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/TreeTest.java index ff7da444b0b..811a5095593 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/TreeTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/TreeTest.java @@ -13,14 +13,14 @@ *******************************************************************************/ package org.eclipse.e4.ui.tests.css.swt; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Tree; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class TreeTest extends CSSSWTTestCase { @@ -45,14 +45,14 @@ protected Tree createTestTree(String styleSheet) { } @Test - public void testTreeColor() { + void testTreeColor() { Tree tableToTest = createTestTree("Tree { background-color: #FF0000; color: #0000FF }"); assertEquals(RED, tableToTest.getBackground().getRGB()); assertEquals(BLUE, tableToTest.getForeground().getRGB()); } @Test - public void testTreeHeaderColor() { + void testTreeHeaderColor() { Tree tableToTest = createTestTree("Tree { swt-header-background-color: #FF0000; swt-header-color: #0000FF }"); assertEquals(RED, tableToTest.getHeaderBackground().getRGB()); assertEquals(BLUE, tableToTest.getHeaderForeground().getRGB());