diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/activities/PatternUtilTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/activities/PatternUtilTest.java index 952b20d87ce0..7ad9a337574e 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/activities/PatternUtilTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/activities/PatternUtilTest.java @@ -15,13 +15,13 @@ package org.eclipse.ui.tests.activities; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.regex.Pattern; import org.eclipse.ui.internal.activities.PatternUtil; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Test for: diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/activities/UtilTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/activities/UtilTest.java index e31258e64b01..10f91a38b922 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/activities/UtilTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/activities/UtilTest.java @@ -13,10 +13,10 @@ *******************************************************************************/ package org.eclipse.ui.tests.activities; -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 java.util.HashMap; import java.util.HashSet; @@ -40,9 +40,9 @@ import org.eclipse.ui.contexts.IContextActivation; import org.eclipse.ui.contexts.IContextService; import org.eclipse.ui.services.IEvaluationService; -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; /** * Tests various utility methods on WorkbenchActivityHelper as well as other misc. activities functionality. @@ -607,12 +607,12 @@ public void testSetEnabledExpressionActivity() { evalService.removeSourceProvider(testSourceProvider); } - @Before + @BeforeEach public void setUp() throws Exception { rememberedSet = getActivityManager().getEnabledActivityIds(); } - @After + @AfterEach public void tearDown() throws Exception { PlatformUI.getWorkbench().getActivitySupport().setEnabledActivityIds( rememberedSet); diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorDescriptorTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorDescriptorTest.java index 17a65da69324..7ad3804b8bdf 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorDescriptorTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorDescriptorTest.java @@ -13,19 +13,19 @@ *******************************************************************************/ package org.eclipse.ui.tests.api; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotNull; import org.eclipse.ui.IEditorDescriptor; import org.eclipse.ui.IFileEditorMapping; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.tests.harness.util.ArrayUtil; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class IEditorDescriptorTest { IEditorDescriptor[] fEditors; - @Before + @BeforeEach public void setUp() { IFileEditorMapping mapping = (IFileEditorMapping) ArrayUtil .pickRandom(PlatformUI.getWorkbench().getEditorRegistry() diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IFileEditorMappingTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IFileEditorMappingTest.java index cc57fb7ae10d..2689c9b1c784 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IFileEditorMappingTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IFileEditorMappingTest.java @@ -13,22 +13,22 @@ *******************************************************************************/ package org.eclipse.ui.tests.api; -import static org.junit.Assert.assertEquals; -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.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.ui.IEditorDescriptor; import org.eclipse.ui.IFileEditorMapping; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.tests.harness.util.ArrayUtil; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; public class IFileEditorMappingTest { private IFileEditorMapping[] fMappings; - @Before + @BeforeEach public void setUp() { fMappings = PlatformUI.getWorkbench().getEditorRegistry() .getFileEditorMappings(); @@ -78,7 +78,7 @@ public void testGetImageDescriptor() throws Throwable { //how do i set the default editor? @Test - @Ignore + @Disabled public void testGetDefaultEditor() throws Throwable { for (IFileEditorMapping fMapping : fMappings) { assertNotNull(fMapping.getDefaultEditor()); diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IPerspectiveDescriptorTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IPerspectiveDescriptorTest.java index 102f83121263..d36064e3e10e 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IPerspectiveDescriptorTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IPerspectiveDescriptorTest.java @@ -13,20 +13,20 @@ *******************************************************************************/ package org.eclipse.ui.tests.api; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.ui.IPerspectiveDescriptor; import org.eclipse.ui.PlatformUI; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class IPerspectiveDescriptorTest { private IPerspectiveDescriptor[] fPerspectives; - @Before + @BeforeEach public void setUp() { fPerspectives = PlatformUI .getWorkbench().getPerspectiveRegistry().getPerspectives(); diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/XMLMementoTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/XMLMementoTest.java index 93af62f8a540..c3175b9589ec 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/XMLMementoTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/XMLMementoTest.java @@ -13,9 +13,9 @@ *******************************************************************************/ package org.eclipse.ui.tests.api; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThrows; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; import java.io.IOException; import java.io.Reader; @@ -25,7 +25,7 @@ import org.eclipse.ui.IMemento; import org.eclipse.ui.WorkbenchException; import org.eclipse.ui.XMLMemento; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Testing XMLMemento (see bug 93262). Emphasis is on ensuring that the 3.1 @@ -52,8 +52,9 @@ public class XMLMementoTest { @Test public void testCreateReadRootReaderExceptionCases() { assertThrows(WorkbenchException.class, () -> XMLMemento.createReadRoot(new StringReader("Invalid format"))); - assertThrows("no exception even though there is noe element", WorkbenchException.class, - () -> XMLMemento.createReadRoot(new StringReader(""))); + assertThrows(WorkbenchException.class, + () -> XMLMemento.createReadRoot(new StringReader("")), + "no exception even though there is noe element"); assertThrows(WorkbenchException.class, () -> XMLMemento.createReadRoot(new Reader() { @@ -479,7 +480,7 @@ public void testIllegalKeys() { for (final String key : illegalKeys) { XMLMemento memento = XMLMemento.createWriteRoot("foo"); - assertThrows("should fail with illegal key", Exception.class, () -> memento.putString(key, "some string")); + assertThrows(Exception.class, () -> memento.putString(key, "some string"), "should fail with illegal key"); } } diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/Bug73756Test.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/Bug73756Test.java index b6b83a072b6b..bc66ab10aa34 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/Bug73756Test.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/Bug73756Test.java @@ -14,8 +14,8 @@ *******************************************************************************/ package org.eclipse.ui.tests.commands; -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 java.text.MessageFormat; import java.util.ResourceBundle; @@ -26,8 +26,8 @@ import org.eclipse.ui.statushandlers.StatusAdapter; import org.eclipse.ui.statushandlers.StatusManager; import org.eclipse.ui.tests.statushandlers.TestStatusHandler; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * A tests whether is active will log an exception if the command is not @@ -50,7 +50,7 @@ public final class Bug73756Test { private static String PLUGIN_ID = "org.eclipse.jface"; - @Before + @BeforeEach public void doTearDown() throws Exception { TestStatusHandler.uninstall(); } @@ -77,7 +77,7 @@ public final void testUndefinedCommandIsActiveLogged() throws Exception { * Checks whether the last handled status is correct */ private void assertStatusAdapter(StatusAdapter statusAdapter) { - assertNotNull("A warning should have been logged.", statusAdapter); + assertNotNull(statusAdapter, "A warning should have been logged."); IStatus status = statusAdapter.getStatus(); assertEquals(status.getSeverity(), SEVERITY); assertEquals(status.getPlugin(), PLUGIN_ID); diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/CommandManagerTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/CommandManagerTest.java index d348a835cc02..07dadfb37092 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/CommandManagerTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/CommandManagerTest.java @@ -14,7 +14,7 @@ package org.eclipse.ui.tests.commands; -import static org.junit.Assert.assertSame; +import static org.junit.jupiter.api.Assertions.assertSame; import org.eclipse.core.commands.Category; import org.eclipse.core.commands.Command; @@ -23,7 +23,7 @@ import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.commands.IExecutionListener; import org.eclipse.core.commands.NotHandledException; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Tests some of the API on command manager. @@ -102,13 +102,13 @@ public final void testExecutionListener() { exception = e; } - assertSame("Should have received a pre-execute event for the correct command", commandId, - listener.preExecuteId); - assertSame("Should have received a pre-execute event with the correct event", event, listener.preExecuteEvent); - assertSame("Should have received a not-handled event for the correct command", commandId, - listener.notHandledId); - assertSame("Should have received a not-handled event with the correct exception", exception, - listener.notHandledException); + assertSame(commandId, + listener.preExecuteId, "Should have received a pre-execute event for the correct command"); + assertSame(event, listener.preExecuteEvent, "Should have received a pre-execute event with the correct event"); + assertSame(commandId, + listener.notHandledId, "Should have received a not-handled event for the correct command"); + assertSame(exception, + listener.notHandledException, "Should have received a not-handled event with the correct exception"); } } diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/CommandParameterTypeTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/CommandParameterTypeTest.java index a45625a13d55..48e32a32f01e 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/CommandParameterTypeTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/CommandParameterTypeTest.java @@ -14,11 +14,11 @@ *******************************************************************************/ package org.eclipse.ui.tests.commands; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThrows; -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.concurrent.atomic.AtomicReference; @@ -34,7 +34,7 @@ import org.eclipse.ui.PlatformUI; import org.eclipse.ui.commands.ICommandService; import org.eclipse.ui.handlers.IHandlerService; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class CommandParameterTypeTest { diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/CommandSerializationTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/CommandSerializationTest.java index 66acd87a5857..4efc817b66a2 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/CommandSerializationTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/CommandSerializationTest.java @@ -13,10 +13,10 @@ *******************************************************************************/ package org.eclipse.ui.tests.commands; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThrows; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +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.Map; @@ -26,7 +26,7 @@ import org.eclipse.core.commands.common.NotDefinedException; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.commands.ICommandService; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Test serialization and deserialization of ParameterizedCommands. See children = zipfileStructureProvider.getChildren(zipfileStructureProvider.getRoot()); - Assert.assertEquals(1, children.size()); + assertEquals(1, children.size()); Enumeration entries = zipFile.entries(); while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); InputStream stream = zipfileStructureProvider.getContents(entry); String name = entry.getName(); if (name.startsWith("../")) { - Assert.assertNull(stream); + assertNull(stream); } else { - Assert.assertNotNull(stream); + assertNotNull(stream); } } } @@ -62,16 +65,16 @@ public void testZipLeveledStructureProvider() throws Exception { try (ZipFile zipFile = new ZipFile(path.toFile()); ZipLeveledStructureProvider zipLeveledStructureProvider = new ZipLeveledStructureProvider(zipFile)) { List children = zipLeveledStructureProvider.getChildren(zipLeveledStructureProvider.getRoot()); - Assert.assertEquals(1, children.size()); + assertEquals(1, children.size()); Enumeration entries = zipFile.entries(); while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); InputStream stream = zipLeveledStructureProvider.getContents(entry); String name = entry.getName(); if (name.startsWith("../")) { - Assert.assertNull(stream); + assertNull(stream); } else { - Assert.assertNotNull(stream); + assertNotNull(stream); } } } diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/ide/api/FileEditorInputTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/ide/api/FileEditorInputTest.java index f1a8d87ae69a..69eb8596976a 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/ide/api/FileEditorInputTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/ide/api/FileEditorInputTest.java @@ -13,7 +13,7 @@ *******************************************************************************/ package org.eclipse.ui.tests.ide.api; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; @@ -26,7 +26,7 @@ import org.eclipse.ui.IFileEditorInput; import org.eclipse.ui.IPersistableElement; import org.eclipse.ui.part.FileEditorInput; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Tests [I]FileEditorInput API. diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/UtilTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/UtilTest.java index 5226749dc33c..f1d7caa01724 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/UtilTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/UtilTest.java @@ -14,10 +14,10 @@ package org.eclipse.ui.tests.internal; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.ui.internal.util.Util; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * @since 3.5 diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/operations/MultiThreadedOperationsTests.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/operations/MultiThreadedOperationsTests.java index eed71146c7a9..421eac136f28 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/operations/MultiThreadedOperationsTests.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/operations/MultiThreadedOperationsTests.java @@ -18,7 +18,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; -import org.junit.Test; +import org.junit.jupiter.api.Test; import junit.framework.TestResult; import junit.framework.TestSuite; diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/quickaccess/CamelUtilTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/quickaccess/CamelUtilTest.java index d9459f9bb3ba..892b078204ef 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/quickaccess/CamelUtilTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/quickaccess/CamelUtilTest.java @@ -13,10 +13,10 @@ *******************************************************************************/ package org.eclipse.ui.tests.quickaccess; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.ui.internal.quickaccess.CamelUtil; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class CamelUtilTest { @@ -66,10 +66,10 @@ private void assertArrayEquals(int[][] is, int[][] camelCaseIndices) { assertEquals(is.length, camelCaseIndices.length); for (int i = 0; i < is.length; i++) { int[] js = is[i]; - assertEquals("i=" + i, js.length, camelCaseIndices[i].length); + assertEquals(js.length, camelCaseIndices[i].length, "i=" + i); for (int j = 0; j < js.length; j++) { - assertEquals("i=" + i + ", j=" + j, js[j], - camelCaseIndices[i][j]); + assertEquals(js[j], + camelCaseIndices[i][j], "i=" + i + ", j=" + j); } } }