use of io.spine.server.procman.given.PmMessageDeliveryTestEnv.PostponingEventDelivery in project core-java by SpineEventEngine.
the class PmMessageDeliveryShould method postpone_events_dispatched_to_reactor_method.
@Test
public void postpone_events_dispatched_to_reactor_method() {
assertNull(ReactingProjectWizard.getEventReceived());
final Event event = projectStarted();
boundedContext.getEventBus().post(event);
assertNull(ReactingProjectWizard.getEventReceived());
final EventEnvelope expectedEnvelope = EventEnvelope.of(event);
final PostponingEventDelivery delivery = repository.getEventEndpointDelivery();
final Map<ProjectId, EventEnvelope> postponedEvents = delivery.getPostponedEvents();
assertTrue(postponedEvents.size() == 1 && postponedEvents.containsValue(expectedEnvelope));
final ProjectId projectId = postponedEvents.keySet().iterator().next();
delivery.deliverNow(projectId, postponedEvents.get(projectId));
final PmProjectStarted deliveredEventMsg = ReactingProjectWizard.getEventReceived();
assertNotNull(deliveredEventMsg);
assertEquals(Events.getMessage(event), deliveredEventMsg);
}
Aggregations