예제 #1
0
 @Test
 public void testDeleteIsCalled() {
   final AtomicBoolean deleteCalled = new AtomicBoolean(false);
   Event event =
       new Event(this) {
         @Override
         public void delete() {
           deleteCalled.set(true);
           super.delete();
         };
       };
   event.acquire();
   assertFalse(deleteCalled.get());
   event.release();
   assertTrue(deleteCalled.get());
 }
예제 #2
0
 @Test(expected = IllegalStateException.class)
 public void testDeleteFailsIfNoAcquire() {
   Event event = new Event(this) {};
   event.release();
 }
예제 #3
0
 @Test
 public void testCreateEvent() {
   Event event = new Event(this) {};
   assertTrue(event.getSource() == this);
 }