@Test
public void testMessageForwarded() {
EventListener mockEventListener = mock(EventListener.class);
MessageHandlerAdapter adapter = new MessageHandlerAdapter(mockEventListener);
final StubDomainEvent payload = new StubDomainEvent();
adapter.handleMessage(new GenericMessage<StubDomainEvent>(payload));
adapter.handleMessage(new GenericMessage<StubDomainEvent>(new StubDomainEvent()));
verify(mockEventListener, times(1)).handle(argThat(new BaseMatcher<EventMessage>() {
@Override
public boolean matches(Object o) {
return ((o instanceof EventMessage) && ((EventMessage) o).getPayload().equals(payload));