Listeners { public void remove(L listener) { try { accessSemaphore.acquire(); } catch(InterruptedException e) { } list.remove(listener); accessSemaphore.release(); } Listeners(); void add(L listener); void remove(L listener); void clear(); boolean dispatch(Event event);  }
@Test public void testRemove() throws Exception { TestListener l = new TestListener(); listeners.add(l); listeners.remove(l); listeners.dispatch(new TestEvent("test")); assertEquals(null, event); }