@Test public void testEmptyEventListRegistration() throws NoSuchFieldException { List<String> subjects = new ArrayList<String>(); EventListener sel = new SampleEventListener(); EventListenerTree mockTree = mock(EventListenerTree.class); PrivateAccessor.setField(registry, "listenerTree", mockTree); registry.registerListener(sel, subjects); verify(mockTree, times(0)).addListener(Matchers.<EventListener>anyObject(), anyString()); }
public void registerListener(EventListener listener, List<String> subjects) { if (listener == null) { throw new IllegalArgumentException("Invalid attempt to register a null EventListener"); } if (subjects == null) { throw new IllegalArgumentException("Invalid attempt to register for null subjects"); } for (String subject : subjects) { registerListener(listener, subject); } }
EventListenerRegistry implements EventListenerRegistryService { public void registerListener(EventListener listener, List<String> subjects) { if (listener == null) { throw new IllegalArgumentException("Invalid attempt to register a null EventListener"); } if (subjects == null) { throw new IllegalArgumentException("Invalid attempt to register for null subjects"); } for (String subject : subjects) { registerListener(listener, subject); } } }
EventListenerRegistry implements EventListenerRegistryService { public void registerListener(EventListener listener, List<String> subjects) { if (listener == null) { throw new IllegalArgumentException("Invalid attempt to register a null EventListener"); } if (subjects == null) { throw new IllegalArgumentException("Invalid attempt to register for null subjects"); } for (String subject : subjects) { registerListener(listener, subject); } }  }
EventListenerRegistry implements EventListenerRegistryService { public void registerListener(EventListener listener, List<String> subjects) { if (listener == null) { throw new IllegalArgumentException("Invalid attempt to register a null EventListener"); } if (subjects == null) { throw new IllegalArgumentException("Invalid attempt to register for null subjects"); } for (String subject : subjects) { registerListener(listener, 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); }
EventListenerRegistry implements EventListenerRegistryService { public void registerListener(EventListener listener, List<String> subjects) { if (listener == null) { throw new IllegalArgumentException("Invalid attempt to register a null EventListener"); } if (subjects == null) { throw new IllegalArgumentException("Invalid attempt to register for null subjects"); } for (String subject : subjects) { registerListener(listener, 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);  }