From d52139e99b382d2816287416fb9970200276b88e Mon Sep 17 00:00:00 2001 From: akwizgran <akwizgran@users.sourceforge.net> Date: Tue, 28 Jan 2014 21:55:57 +0000 Subject: [PATCH] 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. --- .../plugins/file/UnixRemovableDriveMonitorTest.java | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/briar-tests/src/org/briarproject/plugins/file/UnixRemovableDriveMonitorTest.java b/briar-tests/src/org/briarproject/plugins/file/UnixRemovableDriveMonitorTest.java index 8e6488d19a..ce083633a2 100644 --- a/briar-tests/src/org/briarproject/plugins/file/UnixRemovableDriveMonitorTest.java +++ b/briar-tests/src/org/briarproject/plugins/file/UnixRemovableDriveMonitorTest.java @@ -1,6 +1,7 @@ package org.briarproject.plugins.file; import static java.util.concurrent.TimeUnit.SECONDS; +import static org.junit.Assume.assumeTrue; import java.io.File; import java.io.IOException; @@ -12,7 +13,6 @@ import org.briarproject.BriarTestCase; import org.briarproject.TestUtils; import org.briarproject.plugins.file.RemovableDriveMonitor.Callback; import org.briarproject.util.OsUtils; - import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -23,15 +23,12 @@ public class UnixRemovableDriveMonitorTest extends BriarTestCase { @Before public void setUp() { + assumeTrue(OsUtils.isLinux() || OsUtils.isMacLeopardOrNewer()); testDir.mkdirs(); } @Test public void testNonexistentDir() throws Exception { - if(!(OsUtils.isLinux() || OsUtils.isMacLeopardOrNewer())) { - System.err.println("Warning: Skipping test"); - return; - } File doesNotExist = new File(testDir, "doesNotExist"); RemovableDriveMonitor monitor = createMonitor(doesNotExist); monitor.start(new Callback() { @@ -49,10 +46,6 @@ public class UnixRemovableDriveMonitorTest extends BriarTestCase { @Test 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 final List<File> detected = new ArrayList<File>(); final CountDownLatch latch = new CountDownLatch(2); -- GitLab