Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -366,7 +366,7 @@ public IProject[] build(int kind, Map<String, String> 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 ");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -138,7 +138,7 @@ public boolean contains(ISchedulingRule rule) {

@Override
protected IProject[] build(int kind, Map<String, String> 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));
Expand Down Expand Up @@ -189,7 +189,7 @@ public static Iterable<BuildEvent> 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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
}

/**
Expand Down Expand Up @@ -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");
}

/**
Expand All @@ -343,8 +343,8 @@ public static void assertDoesNotExistInWorkspace(IResource[] resources) {
* resource manager to ensure that we have a correct Path -&gt; 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");
}


Expand Down Expand Up @@ -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");
}

/**
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {

Expand All @@ -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.
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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");
Expand All @@ -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");
Expand Down Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down
Loading
Loading