Callback should not be null.

This commit is contained in:
akwizgran
2012-01-11 16:17:14 +00:00
parent 3e61adb623
commit 1499e061c1
3 changed files with 13 additions and 5 deletions

View File

@@ -76,7 +76,11 @@ public class PollingRemovableDriveMonitorTest extends BriarTestCase {
// Create the monitor, start it, and give it some time to run
final RemovableDriveMonitor monitor = new PollingRemovableDriveMonitor(
Executors.newCachedThreadPool(), finder, 10);
monitor.start(null);
monitor.start(new Callback() {
public void driveInserted(File root) {
fail();
}
});
Thread.sleep(50);
// The monitor should rethrow the exception when it stops
try {

View File

@@ -26,19 +26,23 @@ public class UnixRemovableDriveMonitorTest extends BriarTestCase {
@Test
public void testNonexistentDir() throws Exception {
if(!OsUtils.isLinux() || OsUtils.isMacLeopardOrNewer()) {
if(!(OsUtils.isLinux() || OsUtils.isMacLeopardOrNewer())) {
System.err.println("Warning: Skipping test");
return;
}
File doesNotExist = new File(testDir, "doesNotExist");
RemovableDriveMonitor monitor = createMonitor(doesNotExist);
monitor.start(null);
monitor.start(new Callback() {
public void driveInserted(File root) {
fail();
}
});
monitor.stop();
}
@Test
public void testOneCallbackPerFile() throws Exception {
if(!OsUtils.isLinux() || OsUtils.isMacLeopardOrNewer()) {
if(!(OsUtils.isLinux() || OsUtils.isMacLeopardOrNewer())) {
System.err.println("Warning: Skipping test");
return;
}