@Test void testRepeatedEventPublication() throws Exception { List<? extends EventMessage<?>> events = createEvents(2); for (EventMessage<?> event : events) { testSubject.handle(event, Segment.ROOT_SEGMENT); } InOrder inOrder = inOrder(mockHandler1, mockHandler2); inOrder.verify(mockHandler1).handle(events.get(0)); inOrder.verify(mockHandler2).handle(events.get(0)); inOrder.verify(mockHandler1).handle(events.get(1)); inOrder.verify(mockHandler2).handle(events.get(1)); inOrder.verifyNoMoreInteractions(); }
@Override public void handle(EventMessage<?> message, Segment segment) throws Exception { if (sequencingPolicyMatchesSegment(message, segment)) { for (EventMessageHandler handler : wrappedEventHandlers) { try { handler.handle(message); } catch (Exception e) { listenerInvocationErrorHandler.onError(e, message, handler); } } } }
SimpleEventHandlerInvoker implements EventHandlerInvoker { @Override public void handle(EventMessage<?> message, Segment segment) throws Exception { if (sequencingPolicyMatchesSegment(message, segment)) { for (EventMessageHandler handler : wrappedEventHandlers) { try { handler.handle(message); } catch (Exception e) { listenerInvocationErrorHandler.onError(e, message, handler); } } } } }
SimpleEventHandlerInvoker implements EventHandlerInvoker { @Override public void handle(EventMessage<?> message, Segment segment) throws Exception { if (sequencingPolicyMatchesSegment(message, segment)) { for (EventMessageHandler handler : wrappedEventHandlers) { try { handler.handle(message); } catch (Exception e) { listenerInvocationErrorHandler.onError(e, message, handler); } } } } protected  SimpleEventHandlerInvoker(Builder builder); }
SimpleEventHandlerInvoker implements EventHandlerInvoker { @Override public void handle(EventMessage<?> message, Segment segment) throws Exception { if (sequencingPolicyMatchesSegment(message, segment)) { for (EventMessageHandler handler : wrappedEventHandlers) { try { handler.handle(message); } catch (Exception e) { listenerInvocationErrorHandler.onError(e, message, handler); } } } } protected  SimpleEventHandlerInvoker(Builder builder); static Builder builder(); List<?> eventHandlers(); @Override void handle(EventMessage<?> message, Segment segment); @Override boolean canHandle(EventMessage<?> eventMessage, Segment segment); @Override boolean canHandleType(Class<?> payloadType); @Override boolean supportsReset(); @Override void performReset(); @Override void performReset(R resetContext); ListenerInvocationErrorHandler getListenerInvocationErrorHandler(); SequencingPolicy<? super EventMessage<?>> getSequencingPolicy(); }
SimpleEventHandlerInvoker implements EventHandlerInvoker { @Override public void handle(EventMessage<?> message, Segment segment) throws Exception { if (sequencingPolicyMatchesSegment(message, segment)) { for (EventMessageHandler handler : wrappedEventHandlers) { try { handler.handle(message); } catch (Exception e) { listenerInvocationErrorHandler.onError(e, message, handler); } } } } protected  SimpleEventHandlerInvoker(Builder builder); static Builder builder(); List<?> eventHandlers(); @Override void handle(EventMessage<?> message, Segment segment); @Override boolean canHandle(EventMessage<?> eventMessage, Segment segment); @Override boolean canHandleType(Class<?> payloadType); @Override boolean supportsReset(); @Override void performReset(); @Override void performReset(R resetContext); ListenerInvocationErrorHandler getListenerInvocationErrorHandler(); SequencingPolicy<? super EventMessage<?>> getSequencingPolicy();  }