diff --git a/tests/org.eclipse.ui.tests.harness/src/org/eclipse/ui/tests/harness/util/PreferenceMementoExtension.java b/tests/org.eclipse.ui.tests.harness/src/org/eclipse/ui/tests/harness/util/PreferenceMementoExtension.java new file mode 100644 index 00000000000..4bd7ffbc88b --- /dev/null +++ b/tests/org.eclipse.ui.tests.harness/src/org/eclipse/ui/tests/harness/util/PreferenceMementoExtension.java @@ -0,0 +1,64 @@ +/******************************************************************************* + * Copyright (c) 2025 Vector Informatik and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.ui.tests.harness.util; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferenceMemento; +import org.junit.jupiter.api.extension.AfterEachCallback; +import org.junit.jupiter.api.extension.BeforeEachCallback; +import org.junit.jupiter.api.extension.ExtensionContext; + +/** + * Preference helper to restore changed preference values after test run. + */ +public class PreferenceMementoExtension implements BeforeEachCallback, AfterEachCallback { + + private PreferenceMemento prefMemento; + + @Override + public void beforeEach(ExtensionContext context) { + prefMemento = new PreferenceMemento(); + } + + @Override + public void afterEach(ExtensionContext context) { + if (prefMemento != null) { + prefMemento.resetPreferences(); + } + } + + /** + * Change a preference value for the associated test run. The preference will + * automatically be reset to the value it had before starting when executing + * {@link #afterEach(ExtensionContext)}. + * + * @param preference value type. The type must have a corresponding + * {@link IPreferenceStore} setter. + * @param store preference store to manipulate (must not be null) + * @param name preference to change + * @param value new preference value + * @throws IllegalArgumentException when setting a type which is not supported + * by {@link IPreferenceStore} + * + * @see IPreferenceStore#setValue(String, double) + * @see IPreferenceStore#setValue(String, float) + * @see IPreferenceStore#setValue(String, int) + * @see IPreferenceStore#setValue(String, long) + * @see IPreferenceStore#setValue(String, boolean) + * @see IPreferenceStore#setValue(String, String) + */ + public void setPreference(IPreferenceStore store, String name, T value) { + if (prefMemento == null) { + prefMemento = new PreferenceMemento(); + } + prefMemento.setValue(store, name, value); + } +} diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/ActionExpressionTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/ActionExpressionTest.java index 5bdb3f7cfb4..eccf5d2b806 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/ActionExpressionTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/ActionExpressionTest.java @@ -22,19 +22,17 @@ import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.tests.api.ListElement; import org.eclipse.ui.tests.api.ListView; -import org.eclipse.ui.tests.harness.util.CloseTestWindowsRule; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; +import org.eclipse.ui.tests.harness.util.CloseTestWindowsExtension; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; /** * This class contains tests for popup menu enablement */ +@ExtendWith(CloseTestWindowsExtension.class) public abstract class ActionExpressionTest { - @Rule - public final CloseTestWindowsRule closeTestWindowsRule = new CloseTestWindowsRule(); - protected IWorkbenchWindow fWindow; protected IWorkbenchPage fPage; @@ -47,7 +45,7 @@ public abstract class ActionExpressionTest { ListElement redTrue = new ListElement("red", true); - @Before + @BeforeEach public final void setUp() throws Exception { fWindow = openTestWindow(); fPage = fWindow.getActivePage(); diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/Bug41931Test.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/Bug41931Test.java index 75ee538a534..4fcafb901fc 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/Bug41931Test.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/Bug41931Test.java @@ -15,7 +15,7 @@ package org.eclipse.ui.tests.internal; import static org.eclipse.ui.tests.harness.util.UITestUtil.openTestWindow; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.ByteArrayInputStream; import java.io.InputStream; @@ -30,22 +30,20 @@ import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.ide.IDE; import org.eclipse.ui.internal.WorkbenchPage; -import org.eclipse.ui.tests.harness.util.CloseTestWindowsRule; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; +import org.eclipse.ui.tests.harness.util.CloseTestWindowsExtension; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; /** * Test for Bug 41931. * * @since 3.0 */ -@Ignore +@Disabled +@ExtendWith(CloseTestWindowsExtension.class) public class Bug41931Test { - @Rule - public CloseTestWindowsRule closeTestWindows = new CloseTestWindowsRule(); - /** * Tests that the bringToTop(IWorkbenchPart) correctly * updates the activation list. @@ -83,8 +81,8 @@ public void testBringToTop() throws CoreException { IEditorPart[] expectedResults = { editorA, editorB, editorC }; IWorkbenchPartReference[] actualResults = page.getSortedParts(); for (int i = 0; i < expectedResults.length; i++) { - assertEquals( - "Pre-test order is not correct.", expectedResults[i].getTitle(), actualResults[i].getPart(false).getTitle()); //$NON-NLS-1$ + assertEquals(expectedResults[i].getTitle(), actualResults[i].getPart(false).getTitle(), + "Pre-test order is not correct."); //$NON-NLS-1$ } // Bring editor B to the top. @@ -94,8 +92,8 @@ public void testBringToTop() throws CoreException { expectedResults = new IEditorPart[] { editorA, editorC, editorB }; actualResults = page.getSortedParts(); for (int i = 0; i < expectedResults.length; i++) { - assertEquals( - "bringToTop() does not change sorted part order.", expectedResults[i].getTitle(), actualResults[i].getPart(false).getTitle()); //$NON-NLS-1$ + assertEquals(expectedResults[i].getTitle(), actualResults[i].getPart(false).getTitle(), + "bringToTop() does not change sorted part order."); //$NON-NLS-1$ } } } diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/PerspectiveSwitcherTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/PerspectiveSwitcherTest.java index 716e87de09e..07f9020ef16 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/PerspectiveSwitcherTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/PerspectiveSwitcherTest.java @@ -15,25 +15,24 @@ package org.eclipse.ui.tests.internal; import static org.eclipse.ui.PlatformUI.getWorkbench; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotNull; import org.eclipse.e4.ui.workbench.modeling.EModelService; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.ui.IWorkbenchPreferenceConstants; import org.eclipse.ui.internal.WorkbenchWindow; import org.eclipse.ui.internal.util.PrefUtil; -import org.eclipse.ui.tests.harness.util.CloseTestWindowsRule; -import org.eclipse.ui.tests.harness.util.PreferenceMementoRule; -import org.junit.Rule; -import org.junit.Test; +import org.eclipse.ui.tests.harness.util.CloseTestWindowsExtension; +import org.eclipse.ui.tests.harness.util.PreferenceMementoExtension; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.extension.RegisterExtension; +@ExtendWith(CloseTestWindowsExtension.class) public class PerspectiveSwitcherTest { - @Rule - public final CloseTestWindowsRule closeTestWindowsRule = new CloseTestWindowsRule(); - - @Rule - public final PreferenceMementoRule preferenceMemento = new PreferenceMementoRule(); + @RegisterExtension + public final PreferenceMementoExtension preferenceMemento = new PreferenceMementoExtension(); /** * This test ensures that our workbench window's perspective bar can opened if @@ -44,14 +43,14 @@ public void testCreatePerspectiveSwithcerInToolbar() { IPreferenceStore apiPreferenceStore = PrefUtil.getAPIPreferenceStore(); WorkbenchWindow window = (WorkbenchWindow) getWorkbench().getActiveWorkbenchWindow(); - assertNotNull("We should have a perspective bar in the beginning", getPerspectiveSwitcher(window)); //$NON-NLS-1$ + assertNotNull(getPerspectiveSwitcher(window), "We should have a perspective bar in the beginning"); //$NON-NLS-1$ // turn off the 'Open Perspective' item preferenceMemento.setPreference(apiPreferenceStore, IWorkbenchPreferenceConstants.SHOW_OPEN_ON_PERSPECTIVE_BAR, false); // check that we still have a perspective bar - assertNotNull("The perspective bar should have been created successfully", getPerspectiveSwitcher(window)); //$NON-NLS-1$ + assertNotNull(getPerspectiveSwitcher(window), "The perspective bar should have been created successfully"); //$NON-NLS-1$ } diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/StickyViewManagerTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/StickyViewManagerTest.java index 29642ec557d..34495b2227a 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/StickyViewManagerTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/StickyViewManagerTest.java @@ -15,8 +15,8 @@ package org.eclipse.ui.tests.internal; import static org.eclipse.ui.PlatformUI.getWorkbench; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import org.eclipse.ui.IPageLayout; import org.eclipse.ui.IPerspectiveDescriptor; @@ -26,27 +26,26 @@ import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchPreferenceConstants; import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.tests.harness.util.CloseTestWindowsRule; -import org.eclipse.ui.tests.harness.util.PreferenceMementoRule; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; +import org.eclipse.ui.tests.harness.util.CloseTestWindowsExtension; +import org.eclipse.ui.tests.harness.util.PreferenceMementoExtension; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.extension.RegisterExtension; /** * @since 3.6 */ -@Ignore +@Disabled +@ExtendWith(CloseTestWindowsExtension.class) public class StickyViewManagerTest { - @Rule - public final CloseTestWindowsRule closeTestWindowsRule = new CloseTestWindowsRule(); + @RegisterExtension + public final PreferenceMementoExtension preferenceMemento = new PreferenceMementoExtension(); - @Rule - public final PreferenceMementoRule preferenceMemento = new PreferenceMementoRule(); - - @Before + @BeforeEach public final void setUp() throws Exception { preferenceMemento.setPreference(PlatformUI.getPreferenceStore(), IWorkbenchPreferenceConstants.ENABLE_32_STICKY_CLOSE_BEHAVIOR, false); diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/TextHandlerTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/TextHandlerTest.java index 61d0e6eb1ac..9b41fa9cdea 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/TextHandlerTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/TextHandlerTest.java @@ -16,9 +16,9 @@ import static org.eclipse.ui.tests.harness.util.UITestUtil.openTestWindow; import static org.eclipse.ui.tests.harness.util.UITestUtil.processEvents; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assume.assumeFalse; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assumptions.assumeFalse; import org.eclipse.core.runtime.Platform; import org.eclipse.swt.dnd.Clipboard; @@ -27,23 +27,21 @@ import org.eclipse.swt.dnd.URLTransfer; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.actions.TextActionHandler; -import org.eclipse.ui.tests.harness.util.CloseTestWindowsRule; -import org.junit.Rule; -import org.junit.Test; +import org.eclipse.ui.tests.harness.util.CloseTestWindowsExtension; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; /** * Test for {@link TextActionHandler}. * * @since 3.5 */ +@ExtendWith(CloseTestWindowsExtension.class) public class TextHandlerTest { - @Rule - public final CloseTestWindowsRule closeTestWindowsRule = new CloseTestWindowsRule(); - @Test public void testEditableText() throws Exception { - assumeFalse("Test fails on Mac: Bug 544675", Platform.OS_MACOSX.equals(Platform.getOS())); + assumeFalse(Platform.OS_MACOSX.equals(Platform.getOS()), "Test fails on Mac: Bug 544675"); IWorkbenchWindow window = openTestWindow(); TextControlView view = (TextControlView) window.getActivePage() diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/Bug36537Test.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/Bug36537Test.java index 4c7109d8717..aeac46bd1ab 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/Bug36537Test.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/Bug36537Test.java @@ -15,7 +15,7 @@ package org.eclipse.ui.tests.keys; import static org.eclipse.ui.tests.harness.util.UITestUtil.openTestWindow; -import static org.junit.Assert.assertFalse; +import static org.junit.jupiter.api.Assertions.assertFalse; import java.util.ArrayList; import java.util.HashMap; @@ -29,20 +29,18 @@ import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.keys.IBindingService; -import org.eclipse.ui.tests.harness.util.CloseTestWindowsRule; -import org.junit.Rule; -import org.junit.Test; +import org.eclipse.ui.tests.harness.util.CloseTestWindowsExtension; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; /** * Tests Bug 36537 * * @since 3.0 */ +@ExtendWith(CloseTestWindowsExtension.class) public class Bug36537Test { - @Rule - public CloseTestWindowsRule closeTestWindows = new CloseTestWindowsRule(); - /** * Tests that there are no redundant key bindings defined in the * application. @@ -115,8 +113,8 @@ public void testForRedundantKeySequenceBindings() { nullMatches++; } - assertFalse( - "Redundant key bindings: " + binding + ", " + matchedBinding, same && (nullMatches < 1)); //$NON-NLS-1$ //$NON-NLS-2$ + assertFalse(same && (nullMatches < 1), + "Redundant key bindings: " + binding + ", " + matchedBinding); //$NON-NLS-1$ //$NON-NLS-2$ } // Add the key binding. diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/Bug40023Test.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/Bug40023Test.java index 508b9da3690..2c788626081 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/Bug40023Test.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/Bug40023Test.java @@ -15,7 +15,7 @@ package org.eclipse.ui.tests.keys; import static org.eclipse.ui.tests.harness.util.UITestUtil.openTestWindow; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.FileNotFoundException; import java.io.IOException; @@ -33,22 +33,20 @@ import org.eclipse.ui.internal.Workbench; import org.eclipse.ui.internal.keys.BindingService; import org.eclipse.ui.keys.IBindingService; -import org.eclipse.ui.tests.harness.util.CloseTestWindowsRule; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; +import org.eclipse.ui.tests.harness.util.CloseTestWindowsExtension; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; /** * Tests Bug 40023 * * @since 3.0 */ -@Ignore("Intermittent failure. SWT Bug 44344. XGrabPointer?") +@Disabled("Intermittent failure. SWT Bug 44344. XGrabPointer?") +@ExtendWith(CloseTestWindowsExtension.class) public class Bug40023Test { - @Rule - public CloseTestWindowsRule closeTestWindows = new CloseTestWindowsRule(); - /** * Retrieves a menu item matching or starting with the given name from an * array of menu items. @@ -112,7 +110,7 @@ public void testCheckOnCheckbox() throws CoreException, CommandException, "&Window"); //$NON-NLS-1$ MenuItem lockToolBarsMenuItem = getMenuItem(windowMenu.getMenu() .getItems(), "Lock the &Toolbars"); //$NON-NLS-1$ - assertTrue("Checkbox menu item is not checked.", lockToolBarsMenuItem //$NON-NLS-1$ - .getSelection()); + assertTrue(lockToolBarsMenuItem //$NON-NLS-1$ + .getSelection(), "Checkbox menu item is not checked."); } } diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/Bug43321Test.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/Bug43321Test.java index 52ee06904b2..25dad4ce8e2 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/Bug43321Test.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/Bug43321Test.java @@ -15,7 +15,7 @@ package org.eclipse.ui.tests.keys; import static org.eclipse.ui.tests.harness.util.UITestUtil.openTestWindow; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.ByteArrayInputStream; import java.util.ArrayList; @@ -35,22 +35,20 @@ import org.eclipse.ui.internal.Workbench; import org.eclipse.ui.internal.keys.BindingService; import org.eclipse.ui.keys.IBindingService; -import org.eclipse.ui.tests.harness.util.CloseTestWindowsRule; +import org.eclipse.ui.tests.harness.util.CloseTestWindowsExtension; import org.eclipse.ui.tests.harness.util.FileUtil; import org.eclipse.ui.texteditor.AbstractTextEditor; -import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; /** * Tests Bug 43321 * * @since 3.0 */ +@ExtendWith(CloseTestWindowsExtension.class) public class Bug43321Test { - @Rule - public CloseTestWindowsRule closeTestWindows = new CloseTestWindowsRule(); - /** * Tests that non-check box items on the menu are not checked when activated * from the keyboard. @@ -88,7 +86,7 @@ public void testNoCheckOnNonCheckbox() throws CommandException, // Get the menu item we've just selected. IAction action = editor.getEditorSite().getActionBars() .getGlobalActionHandler(ActionFactory.COPY.getId()); - assertTrue("Non-checkbox menu item is checked.", !action.isChecked()); //$NON-NLS-1$ + assertTrue(!action.isChecked(), "Non-checkbox menu item is checked."); //$NON-NLS-1$ FileUtil.deleteProject(testProject); } diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/Bug44460Test.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/Bug44460Test.java index 21b7e0574ce..9fe3831d357 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/Bug44460Test.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/Bug44460Test.java @@ -15,7 +15,7 @@ package org.eclipse.ui.tests.keys; import static org.eclipse.ui.tests.harness.util.UITestUtil.openTestWindow; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.ByteArrayInputStream; import java.util.List; @@ -43,22 +43,20 @@ import org.eclipse.ui.internal.keys.BindingService; import org.eclipse.ui.internal.keys.WorkbenchKeyboard; import org.eclipse.ui.keys.IBindingService; -import org.eclipse.ui.tests.harness.util.CloseTestWindowsRule; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; +import org.eclipse.ui.tests.harness.util.CloseTestWindowsExtension; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; /** * Test for Bug 44460. * * @since 3.0 */ -@Ignore("disabled since it refers to the Java builder and nature, which are not available in an RCP build") +@Disabled("disabled since it refers to the Java builder and nature, which are not available in an RCP build") +@ExtendWith(CloseTestWindowsExtension.class) public class Bug44460Test { - @Rule - public CloseTestWindowsRule closeTestWindows = new CloseTestWindowsRule(); - /** * Test that pressing "Ctrl+Shift+T" in the Team Synchronizing perspective * does not match anything. @@ -116,7 +114,7 @@ public void testCtrlShiftT() throws CommandException, CoreException { // Test that only two child shells are open (default). Shell windowShell = window.getShell(); Shell[] childShells = windowShell.getShells(); - assertTrue( - "Type hierarchy dialog opened inappropriately on 'Ctrl+Shift+T'", (childShells.length == 2)); //$NON-NLS-1$ + assertTrue((childShells.length == 2), + "Type hierarchy dialog opened inappropriately on 'Ctrl+Shift+T'"); //$NON-NLS-1$ } } diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/Bug53489Test.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/Bug53489Test.java index 852cddac235..7d7b898d297 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/Bug53489Test.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/Bug53489Test.java @@ -15,7 +15,7 @@ package org.eclipse.ui.tests.keys; import static org.eclipse.ui.tests.harness.util.UITestUtil.openTestWindow; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.ByteArrayInputStream; import java.io.InputStreamReader; @@ -30,10 +30,10 @@ import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.ide.IDE; import org.eclipse.ui.tests.harness.util.AutomationUtil; -import org.eclipse.ui.tests.harness.util.CloseTestWindowsRule; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; +import org.eclipse.ui.tests.harness.util.CloseTestWindowsExtension; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; /** * Tests that pressing delete in a styled text widget does not cause a double @@ -41,13 +41,11 @@ * * @since 3.0 */ -@Ignore("disabled as it fails on the Mac.") +@Disabled("disabled as it fails on the Mac.") // Ctrl+S doesn't save the editor, and posting MOD1+S also doesn't seem to work. +@ExtendWith(CloseTestWindowsExtension.class) public class Bug53489Test { - @Rule - public CloseTestWindowsRule closeTestWindows = new CloseTestWindowsRule(); - /** * Tests that pressing delete in a styled text widget (in a running Eclipse) * does not cause a double delete. @@ -84,7 +82,7 @@ public void testDoubleDelete() throws Exception { // Test the text is only one character different. LineNumberReader reader = new LineNumberReader(new InputStreamReader(textFile.getContents())); String currentContents = reader.readLine(); - assertTrue("'DEL' deleted more than one key.", (originalContents //$NON-NLS-1$ - .length() == (currentContents.length() + 1))); + assertTrue((originalContents + .length() == (currentContents.length() + 1)), "'DEL' deleted more than one key."); //$NON-NLS-1$ } }