mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-18 13:49:53 +01:00
Callback should not be null.
This commit is contained in:
@@ -28,7 +28,7 @@ JNotifyListener {
|
|||||||
}
|
}
|
||||||
synchronized(this) {
|
synchronized(this) {
|
||||||
assert !started;
|
assert !started;
|
||||||
assert callback == null;
|
assert this.callback == null;
|
||||||
started = true;
|
started = true;
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
this.watches.addAll(watches);
|
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
|
// Create the monitor, start it, and give it some time to run
|
||||||
final RemovableDriveMonitor monitor = new PollingRemovableDriveMonitor(
|
final RemovableDriveMonitor monitor = new PollingRemovableDriveMonitor(
|
||||||
Executors.newCachedThreadPool(), finder, 10);
|
Executors.newCachedThreadPool(), finder, 10);
|
||||||
monitor.start(null);
|
monitor.start(new Callback() {
|
||||||
|
public void driveInserted(File root) {
|
||||||
|
fail();
|
||||||
|
}
|
||||||
|
});
|
||||||
Thread.sleep(50);
|
Thread.sleep(50);
|
||||||
// The monitor should rethrow the exception when it stops
|
// The monitor should rethrow the exception when it stops
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -26,19 +26,23 @@ public class UnixRemovableDriveMonitorTest extends BriarTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNonexistentDir() throws Exception {
|
public void testNonexistentDir() throws Exception {
|
||||||
if(!OsUtils.isLinux() || OsUtils.isMacLeopardOrNewer()) {
|
if(!(OsUtils.isLinux() || OsUtils.isMacLeopardOrNewer())) {
|
||||||
System.err.println("Warning: Skipping test");
|
System.err.println("Warning: Skipping test");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
File doesNotExist = new File(testDir, "doesNotExist");
|
File doesNotExist = new File(testDir, "doesNotExist");
|
||||||
RemovableDriveMonitor monitor = createMonitor(doesNotExist);
|
RemovableDriveMonitor monitor = createMonitor(doesNotExist);
|
||||||
monitor.start(null);
|
monitor.start(new Callback() {
|
||||||
|
public void driveInserted(File root) {
|
||||||
|
fail();
|
||||||
|
}
|
||||||
|
});
|
||||||
monitor.stop();
|
monitor.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOneCallbackPerFile() throws Exception {
|
public void testOneCallbackPerFile() throws Exception {
|
||||||
if(!OsUtils.isLinux() || OsUtils.isMacLeopardOrNewer()) {
|
if(!(OsUtils.isLinux() || OsUtils.isMacLeopardOrNewer())) {
|
||||||
System.err.println("Warning: Skipping test");
|
System.err.println("Warning: Skipping test");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user