示例#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);
 }