use of io.spine.server.event.given.CommandHandlerTestEnv.EventCatcher in project core-java by SpineEventEngine.
the class CommandHandlerShould method post_generated_events_to_event_bus.
@Test
public void post_generated_events_to_event_bus() {
final Command cmd = Given.ACommand.startProject();
final EventCatcher eventCatcher = new EventCatcher();
eventBus.register(eventCatcher);
handler.handle(cmd);
final ImmutableList<Message> expectedMessages = handler.getEventsOnStartProjectCmd();
final List<EventEnvelope> actualEvents = eventCatcher.getDispatched();
for (int i = 0; i < expectedMessages.size(); i++) {
final Message expected = expectedMessages.get(i);
final Message actual = Events.getMessage(actualEvents.get(i).getOuterObject());
assertEquals(expected, actual);
}
}
Aggregations