Ejemplo n.º 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());
 }
Ejemplo n.º 2
0
 @Test(expected = IllegalStateException.class)
 public void testDeleteFailsIfNoAcquire() {
   Event event = new Event(this) {};
   event.release();
 }
Ejemplo n.º 3
0
 @Test
 public void testCreateEvent() {
   Event event = new Event(this) {};
   assertTrue(event.getSource() == this);
 }