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

Callback should not be null.

parent 3e61adb6
No related branches found
No related tags found
No related merge requests found
......@@ -28,7 +28,7 @@ JNotifyListener {
}
synchronized(this) {
assert !started;
assert callback == null;
assert this.callback == null;
started = true;
this.callback = callback;
this.watches.addAll(watches);
......
......@@ -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 {
......
......@@ -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;
}
......
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