EventListenerRegistry implements EventListenerRegistryService { public Set<EventListener> getListeners(String subject) { return listenerTree.getListeners(subject); }  void registerListener(EventListener listener, List<String> subjects); void registerListener(EventListener listener, String subject); Set<EventListener> getListeners(String subject); boolean hasListener(String subject); int getListenerCount(String subject); void clearListenersForBean(String beanName);  }
@Test public void testGetListeners() { List<String> et = new ArrayList<String>(); et.add("org.motechproject.server.someevent"); EventListener sel = new SampleEventListener(); registry.registerListener(sel, et); Set<EventListener> el = registry.getListeners("org.motechproject.server.someevent"); assertNotNull(el); assertEquals(1, el.size()); assertEquals(el.iterator().next(), sel); }
@Test public void testGetEmptyListenerList() { List<String> et = new ArrayList<String>(); et.add("org.motechproject.server.someevent"); assertEquals(0, registry.getListeners(et.get(0)).size()); }