diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/alias/BasicAliasTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/alias/BasicAliasTest.java index a2f3e680f06..12583ff0201 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/alias/BasicAliasTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/alias/BasicAliasTest.java @@ -31,14 +31,14 @@ import static org.eclipse.core.tests.resources.ResourceTestUtil.getFileStore; import static org.eclipse.core.tests.resources.ResourceTestUtil.waitForRefresh; import static org.eclipse.core.tests.resources.ResourceTestUtil.wrapInCanonicalIPath; -import static org.junit.Assume.assumeFalse; -import static org.junit.Assume.assumeTrue; 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.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assumptions.assumeFalse; +import static org.junit.jupiter.api.Assumptions.assumeTrue; import java.io.IOException; import java.net.URI; @@ -274,11 +274,11 @@ public void testBug156082() throws CoreException { */ @Test public void testBug198571() throws Exception { - assumeTrue("only relevant on Windows", OS.isWindows()); + assumeTrue(OS.isWindows(), "only relevant on Windows"); /* look for the adequate environment */ String[] devices = findAvailableDevices(); - assumeFalse("only executable if at least two volumes are present", devices[0] == null || devices[1] == null); + assumeFalse(devices[0] == null || devices[1] == null, "only executable if at least two volumes are present"); String location = createUniqueString(); IProject testProject1 = getWorkspace().getRoot().getProject(location + "1"); diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/builders/BuildDeltaVerificationTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/builders/BuildDeltaVerificationTest.java index 94339d87952..07bcd9cb1a7 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/builders/BuildDeltaVerificationTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/builders/BuildDeltaVerificationTest.java @@ -19,8 +19,8 @@ import static org.eclipse.core.tests.resources.ResourceTestUtil.createTestMonitor; import static org.eclipse.core.tests.resources.ResourceTestUtil.setAutoBuilding; import static org.eclipse.core.tests.resources.ResourceTestUtil.updateProjectDescription; -import static org.junit.Assert.assertSame; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.ByteArrayInputStream; @@ -366,7 +366,7 @@ public IProject[] build(int kind, Map args, IProgressMonitor mon project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, createTestMonitor()); - assertSame("both builders should receive the same cached delta ", deltas.get(0), deltas.get(1)); + assertSame(deltas.get(0), deltas.get(1), "both builders should receive the same cached delta "); } } diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/builders/DeltaVerifierBuilder.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/builders/DeltaVerifierBuilder.java index 82d5226e05d..cf65a79d36a 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/builders/DeltaVerifierBuilder.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/builders/DeltaVerifierBuilder.java @@ -14,12 +14,19 @@ *******************************************************************************/ package org.eclipse.core.tests.internal.builders; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + import java.util.ArrayList; import java.util.Map; -import org.eclipse.core.resources.*; -import org.eclipse.core.runtime.*; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IResourceDelta; +import org.eclipse.core.resources.IncrementalProjectBuilder; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.tests.resources.ResourceDeltaVerifier; -import org.junit.Assert; /** * This classes poses as a builder, and makes sure that the delta supplied to @@ -170,8 +177,8 @@ protected void doCheckDeltas() { emptyDeltas.add(checkDelta); } //regression test -- ensure delta resource is non null - Assert.assertTrue("Non-null delta", delta.getResource() != null); - Assert.assertTrue("Delta rooted at project", delta.getResource().getType() == IResource.PROJECT); + assertNotNull(delta.getResource(), "Non-null delta"); + assertEquals(IResource.PROJECT, delta.getResource().getType(), "Delta rooted at project"); } } } diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/builders/TimerBuilder.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/builders/TimerBuilder.java index d48125fd0ab..aacab67bacc 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/builders/TimerBuilder.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/builders/TimerBuilder.java @@ -14,8 +14,8 @@ package org.eclipse.core.tests.internal.builders; import static org.eclipse.core.tests.resources.TestUtil.waitForCondition; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import java.util.ArrayList; import java.util.Collections; @@ -138,7 +138,7 @@ public boolean contains(ISchedulingRule rule) { @Override protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException { - assertNotEquals("no expected number of builds has been set", -1, executionState.expectedNumberOfBuilds); + assertNotEquals(-1, executionState.expectedNumberOfBuilds, "no expected number of builds has been set"); executionState.startedExecutingProject(getProject()); try { int durationInMillis = Integer.parseInt(args.get(DURATION_ARG)); @@ -189,7 +189,7 @@ public static Iterable getBuildEvents() { * running. */ public static void setExpectedNumberOfBuilds(int expectedNumberOfBuilds) { - assertFalse("builds are still running while resetting TimerBuilder", executionState.isExecuting()); + assertFalse(executionState.isExecuting(), "builds are still running while resetting TimerBuilder"); executionState = new BuildExecutionState(expectedNumberOfBuilds); } diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/filesystem/broken/BrokenFileStore.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/filesystem/broken/BrokenFileStore.java index d1b249623f5..8fa404cffea 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/filesystem/broken/BrokenFileStore.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/filesystem/broken/BrokenFileStore.java @@ -24,7 +24,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; -import org.junit.Assert; +import org.junit.jupiter.api.Assertions; public class BrokenFileStore extends FileStore { @@ -38,7 +38,7 @@ public BrokenFileStore(IPath path) { try { uri = new URI(uri.getScheme(), path.toString(), null); } catch (URISyntaxException e) { - Assert.fail(e.getMessage()); + Assertions.fail(e.getMessage()); } } diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IResourceTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IResourceTest.java index 8cd5fb90e35..a668790c7c5 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IResourceTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IResourceTest.java @@ -89,7 +89,7 @@ import org.eclipse.core.tests.harness.FussyProgressMonitor; import org.eclipse.core.tests.resources.util.FileStoreAutoDeleteExtension; import org.eclipse.core.tests.resources.util.WorkspaceResetExtension; -import org.junit.After; +import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -619,7 +619,7 @@ protected void setupBeforeState(IResource receiver, IResource target, int state, } } - @After + @AfterEach public void tearDown() throws Exception { if (verifier != null) { getWorkspace().removeResourceChangeListener(verifier); diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceTestUtil.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceTestUtil.java index 803c23219d9..4c1ea4ab42b 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceTestUtil.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceTestUtil.java @@ -14,9 +14,9 @@ import static java.io.InputStream.nullInputStream; import static org.assertj.core.api.Assertions.assertThat; import static org.eclipse.core.resources.ResourcesPlugin.getWorkspace; -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.io.ByteArrayInputStream; import java.io.File; @@ -266,8 +266,8 @@ public static void removeFromWorkspace(final IResource[] resources) throws CoreE * info tree. */ public static void assertExistsInWorkspace(IResource resource) { - assertTrue(resource.getFullPath() + " unexpectedly does not exist in the workspace", - existsInWorkspace(resource)); + assertTrue(existsInWorkspace(resource), + resource.getFullPath() + " unexpectedly does not exist in the workspace"); } /** @@ -325,7 +325,7 @@ boolean resourceExists() { * tree. */ public static void assertDoesNotExistInWorkspace(IResource resource) { - assertFalse(resource.getFullPath() + " unexpectedly exists in the workspace", existsInWorkspace(resource)); + assertFalse(existsInWorkspace(resource), resource.getFullPath() + " unexpectedly exists in the workspace"); } /** @@ -343,8 +343,8 @@ public static void assertDoesNotExistInWorkspace(IResource[] resources) { * resource manager to ensure that we have a correct Path -> File mapping. */ public static void assertExistsInFileSystem(IResource resource) { - assertTrue(resource.getFullPath() + " unexpectedly does not exist in the file system", - existsInFileSystem(resource)); + assertTrue(existsInFileSystem(resource), + resource.getFullPath() + " unexpectedly does not exist in the file system"); } @@ -382,7 +382,7 @@ private static IPath computeDefaultLocation(IResource target) { * Assert that the given resource does not exist in the local store. */ public static void assertDoesNotExistInFileSystem(IResource resource) { - assertFalse(resource.getFullPath() + " unexpectedly exists in the file system", existsInFileSystem(resource)); + assertFalse(existsInFileSystem(resource), resource.getFullPath() + " unexpectedly exists in the file system"); } /** @@ -455,7 +455,7 @@ public static void setReadOnly(IFileStore target, boolean value) throws CoreExce */ public static void setReadOnly(IResource target, boolean value) throws CoreException { ResourceAttributes attributes = target.getResourceAttributes(); - assertNotNull("tried to set read only for null attributes", attributes); + assertNotNull(attributes, "tried to set read only for null attributes"); attributes.setReadOnly(value); target.setResourceAttributes(attributes); } @@ -509,7 +509,7 @@ private static void modifyInFileSystem(IFile file) throws FileNotFoundException, */ public static String readStringInFileSystem(IFile file) throws IOException { IPath location = file.getLocation(); - assertNotNull("location was null for file: " + file, location); + assertNotNull(location, "location was null for file: " + file); return new String(Files.readAllBytes(location.toPath()), StandardCharsets.UTF_8); } @@ -767,7 +767,7 @@ public static IFileStore getFileStore(Path path) throws IOException { IPath canonicalIPath = wrapInCanonicalIPath(path); return EFS.getLocalFileSystem().getStore(canonicalIPath); } - + @SuppressWarnings("deprecation") public static boolean isLocal(IResource resource, int depth) { return resource.isLocal(depth); diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/TestUtil.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/TestUtil.java index 4c65575a6f3..952b5ef438e 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/TestUtil.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/TestUtil.java @@ -14,6 +14,8 @@ *******************************************************************************/ package org.eclipse.core.tests.resources; +import static org.junit.jupiter.api.Assertions.assertFalse; + import java.util.ArrayList; import java.util.List; import java.util.function.Supplier; @@ -24,7 +26,6 @@ import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; -import org.junit.Assert; public class TestUtil { @@ -34,7 +35,7 @@ public class TestUtil { */ public static void cleanUp(String owner) { // Ensure that the Thread.interrupted() flag didn't leak. - Assert.assertFalse("The main thread should not be interrupted at the end of a test", Thread.interrupted()); + assertFalse(Thread.interrupted(), "The main thread should not be interrupted at the end of a test"); // Wait for any outstanding jobs to finish. Protect against deadlock by // terminating the wait after a timeout. @@ -47,7 +48,7 @@ public static void cleanUp(String owner) { } // Ensure that the Thread.interrupted() flag didn't leak. - Assert.assertFalse("The main thread should not be interrupted at the end of a test", Thread.interrupted()); + assertFalse(Thread.interrupted(), "The main thread should not be interrupted at the end of a test"); } public static void log(int severity, String owner, String message, Throwable... optionalError) { diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/perf/BenchFileStore.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/perf/BenchFileStore.java index 6fde4e0e51d..50386877b73 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/perf/BenchFileStore.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/perf/BenchFileStore.java @@ -14,7 +14,7 @@ package org.eclipse.core.tests.resources.perf; import static org.eclipse.core.tests.harness.FileSystemHelper.getRandomLocation; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.IOException; import org.eclipse.core.filesystem.EFS; @@ -111,8 +111,8 @@ public void testStoreNotExitsNio() throws Throwable { private static void withNatives(boolean natives, ThrowingRunnable runnable) throws Throwable { try { - assertEquals("can't set natives to the desired value", natives, - LocalFileNativesManager.setUsingNative(natives)); + assertEquals(natives, LocalFileNativesManager.setUsingNative(natives), + "can't set natives to the desired value"); runnable.run(); } finally { LocalFileNativesManager.reset(); diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/perf/WorkspacePerformanceTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/perf/WorkspacePerformanceTest.java index 23365674456..0a343750d3b 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/perf/WorkspacePerformanceTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/perf/WorkspacePerformanceTest.java @@ -19,7 +19,7 @@ import static org.eclipse.core.tests.resources.ResourceTestUtil.createTestMonitor; import static org.eclipse.core.tests.resources.ResourceTestUtil.waitForBuild; import static org.eclipse.core.tests.resources.ResourceTestUtil.waitForRefresh; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.fail; import java.io.ByteArrayInputStream; import java.net.URI; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_025457.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_025457.java index 82f9de04724..a9eef69bd61 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_025457.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_025457.java @@ -20,9 +20,9 @@ import static org.eclipse.core.tests.resources.ResourceTestUtil.createRandomString; import static org.eclipse.core.tests.resources.ResourceTestUtil.createTestMonitor; import static org.eclipse.core.tests.resources.ResourceTestUtil.isReadOnlySupported; -import static org.junit.Assume.assumeTrue; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assumptions.assumeTrue; import java.io.IOException; import java.io.InputStream; @@ -49,7 +49,7 @@ public class Bug_025457 { @Test public void testFile() throws Exception { - assumeTrue("only relevant on Windows", OS.isWindows()); + assumeTrue(OS.isWindows(), "only relevant on Windows"); IProject source = getWorkspace().getRoot().getProject("project"); IFile sourceFile = source.getFile("file.txt"); @@ -75,7 +75,7 @@ public void testFile() throws Exception { @Test public void testFolder() throws IOException, CoreException { //native code must also be present so move can detect the case change - assumeTrue("only relevant on Windows", OS.isWindows() && isReadOnlySupported()); + assumeTrue(OS.isWindows() && isReadOnlySupported(), "only relevant on Windows"); IProject source = getWorkspace().getRoot().getProject("SourceProject"); IFolder sourceFolder = source.getFolder("folder"); @@ -104,7 +104,7 @@ public void testFolder() throws IOException, CoreException { @Test public void testProject() throws IOException, CoreException { - assumeTrue("only relevant on Windows", OS.isWindows()); + assumeTrue(OS.isWindows(), "only relevant on Windows"); IProject source = getWorkspace().getRoot().getProject("project"); IProject destination = getWorkspace().getRoot().getProject("Project"); diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_026294.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_026294.java index 17a7eb43e95..2e114ba53d1 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_026294.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_026294.java @@ -25,8 +25,8 @@ import static org.eclipse.core.tests.resources.ResourceTestUtil.createUniqueString; import static org.eclipse.core.tests.resources.ResourceTestUtil.isReadOnlySupported; import static org.eclipse.core.tests.resources.ResourceTestUtil.setReadOnly; -import static org.junit.Assume.assumeTrue; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assumptions.assumeTrue; import java.io.InputStream; import java.util.function.Predicate; @@ -62,7 +62,7 @@ public class Bug_026294 { */ @Test public void testDeleteOpenProjectWindows() throws Exception { - assumeTrue("only relevant on Windows", OS.isWindows()); + assumeTrue(OS.isWindows(), "only relevant on Windows\""); IWorkspace workspace = getWorkspace(); IProject project = workspace.getRoot().getProject(createUniqueString()); @@ -132,7 +132,7 @@ public void testDeleteOpenProjectWindows() throws Exception { */ @Test public void testDeleteOpenProjectLinux() throws CoreException { - assumeTrue("only relevant on Linux", OS.isLinux() && isReadOnlySupported()); + assumeTrue(OS.isLinux() && isReadOnlySupported(), "only relevant on Linux"); IWorkspace workspace = getWorkspace(); IProject project = workspace.getRoot().getProject(createUniqueString()); @@ -179,7 +179,7 @@ public void testDeleteOpenProjectLinux() throws CoreException { */ @Test public void testDeleteClosedProjectWindows() throws Exception { - assumeTrue("only relevant on Windows", OS.isWindows()); + assumeTrue(OS.isWindows(), "only relevant on Windows"); IWorkspace workspace = getWorkspace(); IProject project = workspace.getRoot().getProject(createUniqueString()); @@ -216,7 +216,7 @@ public void testDeleteClosedProjectWindows() throws Exception { */ @Test public void testDeleteClosedProjectLinux() throws CoreException { - assumeTrue("only relevant on Linux", OS.isLinux()); + assumeTrue(OS.isLinux(), "only relevant on Linux"); IWorkspace workspace = getWorkspace(); IProject project = workspace.getRoot().getProject(createUniqueString()); @@ -259,7 +259,7 @@ public void testDeleteClosedProjectLinux() throws CoreException { */ @Test public void testDeleteFolderWindows() throws Exception { - assumeTrue("only relevant on Windows", OS.isWindows()); + assumeTrue(OS.isWindows(), "only relevant on Windows"); IWorkspace workspace = getWorkspace(); IProject project = workspace.getRoot().getProject(createUniqueString()); @@ -291,7 +291,7 @@ public void testDeleteFolderWindows() throws Exception { */ @Test public void testDeleteFolderLinux() throws CoreException { - assumeTrue("only relevant on Linux", OS.isLinux()); + assumeTrue(OS.isLinux(), "only relevant on Linux"); IWorkspace workspace = getWorkspace(); IProject project = workspace.getRoot().getProject(createUniqueString()); diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_027271.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_027271.java index e9d96e52ef7..67dad062416 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_027271.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_027271.java @@ -15,8 +15,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.eclipse.core.resources.ResourcesPlugin.getWorkspace; -import static org.junit.Assume.assumeTrue; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assumptions.assumeTrue; import org.eclipse.core.resources.IPathVariableManager; import org.eclipse.core.resources.ResourcesPlugin; @@ -63,7 +63,7 @@ private void clearPathVariablesProperties() { @Test public void testBug() { - assumeTrue("only relevant on Windows", OS.isWindows()); + assumeTrue(OS.isWindows(), "only relevant on Windows"); IPathVariableManager pvm = getWorkspace().getPathVariableManager(); Preferences prefs = ResourcesPlugin.getPlugin().getPluginPreferences(); diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_032076.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_032076.java index 6e77f222fa7..2828450dfaf 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_032076.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_032076.java @@ -24,10 +24,10 @@ import static org.eclipse.core.tests.resources.ResourceTestUtil.isReadOnlySupported; import static org.eclipse.core.tests.resources.ResourceTestUtil.removeFromFileSystem; import static org.eclipse.core.tests.resources.ResourceTestUtil.setReadOnly; -import static org.junit.Assume.assumeTrue; 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.Assumptions.assumeTrue; import java.io.File; import java.io.IOException; @@ -66,7 +66,7 @@ public class Bug_032076 { @Test public void testFileBugOnWindows() throws Exception { - assumeTrue("only relevant on Windows", OS.isWindows()); + assumeTrue(OS.isWindows(), "only relevant on Windows"); IWorkspace workspace = getWorkspace(); IProject project = workspace.getRoot().getProject(createUniqueString()); @@ -117,7 +117,7 @@ public void testFileBugOnWindows() throws Exception { @Test public void testFolderBugOnWindows() throws Exception { - assumeTrue("only relevant on Windows", OS.isWindows()); + assumeTrue(OS.isWindows(), "only relevant on Windows"); IWorkspace workspace = getWorkspace(); IProject project = workspace.getRoot().getProject(createUniqueString()); @@ -177,7 +177,7 @@ public void testFolderBugOnWindows() throws Exception { @Test public void testProjectBugOnWindows() throws Exception { - assumeTrue("only relevant on Windows", OS.isWindows()); + assumeTrue(OS.isWindows(), "only relevant on Windows"); IWorkspace workspace = getWorkspace(); IProject sourceProject = workspace.getRoot().getProject(createUniqueString() + ".source"); @@ -226,7 +226,7 @@ public void testProjectBugOnWindows() throws Exception { @Test @Disabled("test is currently failing and needs further investigation (bug 203078)") public void testFileBugOnLinux() throws CoreException { - assumeTrue("only relevant on Linux", OS.isLinux() && isReadOnlySupported()); + assumeTrue(OS.isLinux() && isReadOnlySupported(), "only relevant on Linux"); IWorkspace workspace = getWorkspace(); IProject project = workspace.getRoot().getProject(createUniqueString()); @@ -283,7 +283,7 @@ public void testFileBugOnLinux() throws CoreException { @Test @Disabled("test is currently failing and needs further investigation (bug 203078)") public void testFolderBugOnLinux() throws CoreException { - assumeTrue("only relevant on Linux", OS.isLinux() && isReadOnlySupported()); + assumeTrue(OS.isLinux() && isReadOnlySupported(), "only relevant on Linux"); IWorkspace workspace = getWorkspace(); IProject project = workspace.getRoot().getProject(createUniqueString()); @@ -356,7 +356,7 @@ public void testFolderBugOnLinux() throws CoreException { @Test @Disabled("test is currently failing and needs further investigation (bug 203078)") public void testProjectBugOnLinux(@TempDir Path tempDirectory) throws CoreException, IOException { - assumeTrue("only relevant on Linux", OS.isLinux() && isReadOnlySupported()); + assumeTrue(OS.isLinux() && isReadOnlySupported(), "only relevant on Linux"); IWorkspace workspace = getWorkspace(); IProject sourceProject = workspace.getRoot().getProject(createUniqueString() + ".source"); diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_044106.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_044106.java index c274d546a88..f9fdb367eaa 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_044106.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_044106.java @@ -23,7 +23,7 @@ import static org.eclipse.core.tests.resources.ResourceTestUtil.createTestMonitor; import static org.eclipse.core.tests.resources.ResourceTestUtil.createUniqueString; import static org.eclipse.core.tests.resources.ResourceTestUtil.getFileStore; -import static org.junit.Assume.assumeTrue; +import static org.junit.jupiter.api.Assumptions.assumeTrue; import java.io.IOException; import java.nio.file.Path; @@ -100,7 +100,7 @@ private void doTestDeleteLinkedFile(int deleteFlags) throws Exception { */ private void doTestDeleteLinkedFolder(IFolder linkedFolder, boolean deleteParent, int deleteFlags) throws Exception { - assumeTrue("only relevant on Linux", OS.isLinux()); + assumeTrue(OS.isLinux(), "only relevant on Linux"); IFileStore linkDestLocation = getFileStore(tempDirectory); IFileStore linkDestFile = linkDestLocation.getChild(createUniqueString()); @@ -140,14 +140,14 @@ private void doTestDeleteLinkedFolder(IFolder linkedFolder, boolean deleteParent @Test public void testDeleteLinkedFile() throws Exception { - assumeTrue("only relevant on Linux", OS.isLinux()); + assumeTrue(OS.isLinux(), "only relevant on Linux"); doTestDeleteLinkedFile(IResource.NONE); } @Test public void testDeleteLinkedFolder() throws Exception { - assumeTrue("only relevant on Linux", OS.isLinux()); + assumeTrue(OS.isLinux(), "only relevant on Linux"); IProject project = getWorkspace().getRoot().getProject(createUniqueString()); IFolder linkedFolder = project.getFolder("linkedFolder"); @@ -156,7 +156,7 @@ public void testDeleteLinkedFolder() throws Exception { @Test public void testDeleteLinkedResourceInProject() throws Exception { - assumeTrue("only relevant on Linux", OS.isLinux()); + assumeTrue(OS.isLinux(), "only relevant on Linux"); IProject project = getWorkspace().getRoot().getProject(createUniqueString()); IFolder linkedFolder = project.getFolder("linkedFolder"); @@ -165,14 +165,14 @@ public void testDeleteLinkedResourceInProject() throws Exception { @Test public void testDeleteLinkedFileKeepHistory() throws Exception { - assumeTrue("only relevant on Linux", OS.isLinux()); + assumeTrue(OS.isLinux(), "only relevant on Linux"); doTestDeleteLinkedFile(IResource.KEEP_HISTORY); } @Test public void testDeleteLinkedFolderParentKeepHistory() throws Exception { - assumeTrue("only relevant on Linux", OS.isLinux()); + assumeTrue(OS.isLinux(), "only relevant on Linux"); IProject project = getWorkspace().getRoot().getProject(createUniqueString()); IFolder parent = project.getFolder("parent"); @@ -182,7 +182,7 @@ public void testDeleteLinkedFolderParentKeepHistory() throws Exception { @Test public void testDeleteLinkedFolderKeepHistory() throws Exception { - assumeTrue("only relevant on Linux", OS.isLinux()); + assumeTrue(OS.isLinux(), "only relevant on Linux"); IProject project = getWorkspace().getRoot().getProject(createUniqueString()); IFolder linkedFolder = project.getFolder("linkedFolder"); @@ -191,7 +191,7 @@ public void testDeleteLinkedFolderKeepHistory() throws Exception { @Test public void testDeleteLinkedResourceInProjectKeepHistory() throws Exception { - assumeTrue("only relevant on Linux", OS.isLinux()); + assumeTrue(OS.isLinux(), "only relevant on Linux"); IProject project = getWorkspace().getRoot().getProject(createUniqueString()); IFolder linkedFolder = project.getFolder("linkedFolder"); diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_092108.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_092108.java index f1b577681c0..c28c0a5f6de 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_092108.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_092108.java @@ -14,7 +14,7 @@ package org.eclipse.core.tests.resources.regression; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assume.assumeTrue; +import static org.junit.jupiter.api.Assumptions.assumeTrue; import org.eclipse.core.filesystem.EFS; import org.eclipse.core.filesystem.IFileInfo; @@ -33,7 +33,7 @@ public class Bug_092108 { @Test public void testBug() throws CoreException { - assumeTrue("only relevant on Windows", OS.isWindows()); + assumeTrue(OS.isWindows(), "only relevant on Windows"); IFileStore root = EFS.getStore(new java.io.File("c:\\").toURI()); IFileInfo info = root.fetchInfo(); diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_233939.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_233939.java index 70ca21c6fd9..923d9acf1c6 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_233939.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_233939.java @@ -23,7 +23,7 @@ import static org.eclipse.core.tests.resources.ResourceTestUtil.createTestMonitor; import static org.eclipse.core.tests.resources.ResourceTestUtil.createUniqueString; import static org.eclipse.core.tests.resources.ResourceTestUtil.getFileStore; -import static org.junit.Assume.assumeTrue; +import static org.junit.jupiter.api.Assumptions.assumeTrue; import java.io.IOException; import java.net.URI; @@ -50,7 +50,7 @@ public class Bug_233939 { @BeforeEach public void requireCanCreateSymlinks() throws IOException { - assumeTrue("only relevant for platforms supporting symbolic links", canCreateSymLinks()); + assumeTrue(canCreateSymLinks(), "only relevant for platforms supporting symbolic links"); } /** diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_329836.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_329836.java index bf2fd91d97d..e6f8f56e08b 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_329836.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_329836.java @@ -20,7 +20,7 @@ import static org.eclipse.core.tests.resources.ResourceTestUtil.createUniqueString; import static org.eclipse.core.tests.resources.ResourceTestUtil.getFileStore; import static org.eclipse.core.tests.resources.ResourceTestUtil.isAttributeSupported; -import static org.junit.Assume.assumeTrue; +import static org.junit.jupiter.api.Assumptions.assumeTrue; import java.nio.file.Path; import org.eclipse.core.filesystem.EFS; @@ -40,7 +40,7 @@ public class Bug_329836 { @Test public void testBug(@TempDir Path tempDirectory) throws Exception { - assumeTrue("only relevant on Mac", OS.isMac()); + assumeTrue(OS.isMac(), "only relevant on Mac"); IFileStore fileStore = getFileStore(tempDirectory).getChild(createUniqueString()); createInFileSystem(fileStore); diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_530868.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_530868.java index 2d51993317d..39e0b33017e 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_530868.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_530868.java @@ -15,8 +15,8 @@ import static org.eclipse.core.resources.ResourcesPlugin.getWorkspace; import static org.eclipse.core.tests.resources.ResourceTestUtil.createTestMonitor; -import static org.junit.Assume.assumeFalse; import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assumptions.assumeFalse; import java.io.ByteArrayInputStream; import org.eclipse.core.filesystem.provider.FileInfo; @@ -56,7 +56,7 @@ public void setUp(TestInfo testInfo) throws Exception { */ @Test public void testMillisecondResolution() throws Exception { - assumeFalse("not relevant on Mac, as it does not have milliseconds resolution", OS.isMac()); + assumeFalse(OS.isMac(), "not relevant on Mac, as it does not have milliseconds resolution"); try { /* * Run 3 times in case we have seconds resolution due to a bug, but by chance we diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/IFileTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/IFileTest.java index 7a1b4de08b9..f7e6f7081ab 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/IFileTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/IFileTest.java @@ -20,10 +20,10 @@ import static org.eclipse.core.tests.resources.ResourceTestUtil.createRandomContentsStream; import static org.eclipse.core.tests.resources.ResourceTestUtil.createTestMonitor; import static org.eclipse.core.tests.resources.ResourceTestUtil.isReadOnlySupported; -import static org.junit.Assume.assumeFalse; -import static org.junit.Assume.assumeTrue; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assumptions.assumeFalse; +import static org.junit.jupiter.api.Assumptions.assumeTrue; import java.io.IOException; import java.io.InputStream; @@ -60,10 +60,10 @@ public class IFileTest { public void testBug25658() throws CoreException { // We need to know whether or not we can unset the read-only flag // in order to perform this test. - assumeTrue("only relevant for platforms supporting read-only files", isReadOnlySupported()); + assumeTrue(isReadOnlySupported(), "only relevant for platforms supporting read-only files"); // Don't test this on Windows - assumeFalse("not relevant on Windows", OS.isWindows()); + assumeFalse(OS.isWindows(), "not relevant on Windows"); IProject project = getWorkspace().getRoot().getProject("MyProject"); IFolder folder = project.getFolder("folder"); @@ -91,11 +91,11 @@ public void testBug25662() throws CoreException { // We need to know whether or not we can unset the read-only flag // in order to perform this test. - assumeTrue("only relevant for platforms supporting read-only files", isReadOnlySupported()); + assumeTrue(isReadOnlySupported(), "only relevant for platforms supporting read-only files"); // Only run this test on Linux for now since Windows lets you create // a file within a read-only folder. - assumeTrue("only relevant on Linux", OS.isLinux()); + assumeTrue(OS.isLinux(), "only relevant on Linux"); IProject project = getWorkspace().getRoot().getProject("MyProject"); IFolder folder = project.getFolder("folder"); diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/IFolderTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/IFolderTest.java index 351ea41488b..a437d7820e8 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/IFolderTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/IFolderTest.java @@ -20,9 +20,9 @@ import static org.eclipse.core.tests.resources.ResourceTestUtil.createInWorkspace; import static org.eclipse.core.tests.resources.ResourceTestUtil.createTestMonitor; import static org.eclipse.core.tests.resources.ResourceTestUtil.isReadOnlySupported; -import static org.junit.Assume.assumeTrue; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assumptions.assumeTrue; import java.util.function.Predicate; import org.eclipse.core.filesystem.EFS; @@ -51,11 +51,11 @@ public class IFolderTest { public void testBug25662() throws CoreException { // We need to know whether or not we can unset the read-only flag // in order to perform this test. - assumeTrue("only relevant for platforms supporting read-only files", isReadOnlySupported()); + assumeTrue(isReadOnlySupported(), "only relevant for platforms supporting read-only files"); // Only run this test on Linux for now since Windows lets you create // a file within a read-only folder. - assumeTrue("only relevant on Linux", OS.isLinux()); + assumeTrue(OS.isLinux(), "only relevant on Linux"); IProject project = getWorkspace().getRoot().getProject("MyProject"); IFolder parentFolder = project.getFolder("parentFolder"); diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/IResourceTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/IResourceTest.java index 630cb45d104..f17c3843b6b 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/IResourceTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/IResourceTest.java @@ -26,12 +26,12 @@ import static org.eclipse.core.tests.resources.ResourceTestUtil.ensureOutOfSync; import static org.eclipse.core.tests.resources.ResourceTestUtil.isAttributeSupported; import static org.eclipse.core.tests.resources.ResourceTestUtil.removeFromWorkspace; -import static org.junit.Assume.assumeTrue; 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.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assumptions.assumeTrue; import java.io.FileOutputStream; import java.io.InputStream; @@ -106,8 +106,8 @@ public void testBug25686() throws CoreException { @Test public void testBug28790() throws CoreException { - assumeTrue("only relevant for platforms supporting archive attribute", - isAttributeSupported(EFS.ATTRIBUTE_ARCHIVE)); + assumeTrue(isAttributeSupported(EFS.ATTRIBUTE_ARCHIVE), + "only relevant for platforms supporting archive attribute"); IProject project = getWorkspace().getRoot().getProject("MyProject"); IFile file = project.getFile("a.txt"); @@ -220,7 +220,7 @@ public void testBug83777() throws CoreException { @Test public void testBug111821() throws CoreException { - assumeTrue("only relevant on Windows", OS.isWindows()); + assumeTrue(OS.isWindows(), "only relevant on Windows"); IProject project = getWorkspace().getRoot().getProject("testBug111821"); IFolder folder = project.getFolder(new Path(null, "c:")); @@ -260,7 +260,7 @@ public void testCopy_1GA6QJP() throws CoreException, InterruptedException { */ @Test public void testCreate_1FW87XF() throws Throwable { - assumeTrue("only relevant on Linux", OS.isLinux()); + assumeTrue(OS.isLinux(), "only relevant on Linux"); // test if the file system is case sensitive boolean caseSensitive = new java.io.File("abc").compareTo(new java.io.File("ABC")) != 0; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/PR_1GEAB3C_Test.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/PR_1GEAB3C_Test.java index 30b24bee878..47153b49e44 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/PR_1GEAB3C_Test.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/PR_1GEAB3C_Test.java @@ -17,7 +17,7 @@ import static org.eclipse.core.tests.resources.ResourceTestUtil.createTestMonitor; import static org.eclipse.core.tests.resources.ResourceTestUtil.waitForBuild; import static org.eclipse.core.tests.resources.ResourceTestUtil.waitForRefresh; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.core.internal.preferences.EclipsePreferences; import org.eclipse.core.resources.IFile; @@ -89,7 +89,7 @@ public void test_1GEAB3C() throws CoreException { } }; getWorkspace().run(body, createTestMonitor()); - assertTrue(verifier.getMessage(), verifier.isDeltaValid()); + assertTrue(verifier.isDeltaValid(), verifier.getMessage()); } }