mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
Changed the root package from net.sf.briar to org.briarproject.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package org.briarproject.lifecycle;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.briarproject.BriarTestCase;
|
||||
import org.briarproject.api.lifecycle.ShutdownManager;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class ShutdownManagerImplTest extends BriarTestCase {
|
||||
|
||||
@Test
|
||||
public void testAddAndRemove() {
|
||||
ShutdownManager s = createShutdownManager();
|
||||
Set<Integer> handles = new HashSet<Integer>();
|
||||
for(int i = 0; i < 100; i++) {
|
||||
int handle = s.addShutdownHook(new Runnable() {
|
||||
public void run() {}
|
||||
});
|
||||
// The handles should all be distinct
|
||||
assertTrue(handles.add(handle));
|
||||
}
|
||||
// The hooks should be removable
|
||||
for(int handle : handles) assertTrue(s.removeShutdownHook(handle));
|
||||
// The hooks should no longer be removable
|
||||
for(int handle : handles) assertFalse(s.removeShutdownHook(handle));
|
||||
}
|
||||
|
||||
protected ShutdownManager createShutdownManager() {
|
||||
return new ShutdownManagerImpl();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user