Search in sources :

Example 1 with OtherSampleEventListener

use of org.motechproject.event.listener.OtherSampleEventListener in project motech by motech.

the class EventListenerRegistryTest method testRemovingListenerPreservesOtherListeners.

@Test
public void testRemovingListenerPreservesOtherListeners() {
    List<String> et = new ArrayList<String>();
    et.add("org.motechproject.server.someevent");
    EventListener sel = new SampleEventListener();
    EventListener se2 = new OtherSampleEventListener();
    registry.registerListener(sel, et);
    registry.registerListener(se2, et);
    Set<EventListener> el = registry.getListeners("org.motechproject.server.someevent");
    assertEquals(2, el.size());
    registry.clearListenersForBean("TestEventListener");
    el = registry.getListeners("org.motechproject.server.someevent");
    assertEquals(1, el.size());
    registry.clearListenersForBean("TestEventListener2");
    el = registry.getListeners("org.motechproject.server.someevent");
    assertEquals(0, el.size());
}
Also used : OtherSampleEventListener(org.motechproject.event.listener.OtherSampleEventListener) ArrayList(java.util.ArrayList) Matchers.anyString(org.mockito.Matchers.anyString) OtherSampleEventListener(org.motechproject.event.listener.OtherSampleEventListener) EventListener(org.motechproject.event.listener.EventListener) SampleEventListener(org.motechproject.event.listener.SampleEventListener) OtherSampleEventListener(org.motechproject.event.listener.OtherSampleEventListener) SampleEventListener(org.motechproject.event.listener.SampleEventListener) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 Matchers.anyString (org.mockito.Matchers.anyString)1 EventListener (org.motechproject.event.listener.EventListener)1 OtherSampleEventListener (org.motechproject.event.listener.OtherSampleEventListener)1 SampleEventListener (org.motechproject.event.listener.SampleEventListener)1