/** * Adds a listener to this producer. * <p> * If the listener was previously added to this consumer, as determined by reference equality or {@code Object} * equality, then this method does nothing. * <p> * If a listener is added, concurrently, during the occurrence of a cycle or restore then the listener will not * receive events until the next cycle or restore. The listener may also be removed concurrently. * * @param listener the listener to add */ public void addListener(HollowProducerEventListener listener) { listeners.addListener(listener); }
/** * Adds a listener to this producer. * <p> * If the listener was previously added to this consumer, as determined by reference equality or {@code Object} * equality, then this method does nothing. * <p> * If a listener is added, concurrently, during the occurrence of a cycle or restore then the listener will not * receive events until the next cycle or restore. The listener may also be removed concurrently. * * @param listener the listener to add */ public void addListener(HollowProducerListener listener) { listeners.addListener(listener); }
@Before public void setUp() { MockitoAnnotations.initMocks(this); listenerSupport = new ListenerSupport(); listenerSupport.addListener(listener); listenerSupport.addListener(validationStatusListener); listenerSupport.addListener(producerAndValidationStatusListener); }
@Test public void testDuplicates() { ListenerSupport ls = new ListenerSupport(); CycleListener l = Mockito.mock(CycleListener.class); ls.addListener(l); ls.addListener(l); ListenerSupport.Listeners s = ls.listeners(); s.fireCycleStart(1); Mockito.verify(l, Mockito.times(1)).onCycleStart(1); }
ls.addListener(fcl); ls.addListener(scl);
ls.addListener(fcl);