Skip to content
Snippets Groups Projects
Commit d52139e9 authored by akwizgran's avatar akwizgran
Browse files

Use JUnit's Assume to skip tests rather than returning from the tests.

This way the tests won't show up as having run if they didn't.
parent 905eaa5c
No related branches found
No related tags found
No related merge requests found
package org.briarproject.plugins.file; package org.briarproject.plugins.file;
import static java.util.concurrent.TimeUnit.SECONDS; import static java.util.concurrent.TimeUnit.SECONDS;
import static org.junit.Assume.assumeTrue;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
...@@ -12,7 +13,6 @@ import org.briarproject.BriarTestCase; ...@@ -12,7 +13,6 @@ import org.briarproject.BriarTestCase;
import org.briarproject.TestUtils; import org.briarproject.TestUtils;
import org.briarproject.plugins.file.RemovableDriveMonitor.Callback; import org.briarproject.plugins.file.RemovableDriveMonitor.Callback;
import org.briarproject.util.OsUtils; import org.briarproject.util.OsUtils;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
...@@ -23,15 +23,12 @@ public class UnixRemovableDriveMonitorTest extends BriarTestCase { ...@@ -23,15 +23,12 @@ public class UnixRemovableDriveMonitorTest extends BriarTestCase {
@Before @Before
public void setUp() { public void setUp() {
assumeTrue(OsUtils.isLinux() || OsUtils.isMacLeopardOrNewer());
testDir.mkdirs(); testDir.mkdirs();
} }
@Test @Test
public void testNonexistentDir() throws Exception { public void testNonexistentDir() throws Exception {
if(!(OsUtils.isLinux() || OsUtils.isMacLeopardOrNewer())) {
System.err.println("Warning: Skipping test");
return;
}
File doesNotExist = new File(testDir, "doesNotExist"); File doesNotExist = new File(testDir, "doesNotExist");
RemovableDriveMonitor monitor = createMonitor(doesNotExist); RemovableDriveMonitor monitor = createMonitor(doesNotExist);
monitor.start(new Callback() { monitor.start(new Callback() {
...@@ -49,10 +46,6 @@ public class UnixRemovableDriveMonitorTest extends BriarTestCase { ...@@ -49,10 +46,6 @@ public class UnixRemovableDriveMonitorTest extends BriarTestCase {
@Test @Test
public void testOneCallbackPerFile() throws Exception { public void testOneCallbackPerFile() throws Exception {
if(!(OsUtils.isLinux() || OsUtils.isMacLeopardOrNewer())) {
System.err.println("Warning: Skipping test");
return;
}
// Create a callback that will wait for two files before stopping // Create a callback that will wait for two files before stopping
final List<File> detected = new ArrayList<File>(); final List<File> detected = new ArrayList<File>();
final CountDownLatch latch = new CountDownLatch(2); final CountDownLatch latch = new CountDownLatch(2);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment