use of io.spine.test.procman.rejection.Rejections.PmCannotStartArchivedProject in project core-java by SpineEventEngine.
the class PmMessageDeliveryShould method postpone_rejections_dispatched_to_reactor_method.
@Test
public void postpone_rejections_dispatched_to_reactor_method() {
assertNull(ReactingProjectWizard.getEventReceived());
final Rejection rejection = cannotStartProject();
boundedContext.getRejectionBus().post(rejection);
assertNull(ReactingProjectWizard.getRejectionReceived());
final RejectionEnvelope expectedEnvelope = RejectionEnvelope.of(rejection);
final PostponingRejectionDelivery delivery = repository.getRejectionEndpointDelivery();
final Map<ProjectId, RejectionEnvelope> postponedRejections = delivery.getPostponedRejections();
assertTrue(postponedRejections.size() == 1 && postponedRejections.containsValue(expectedEnvelope));
final ProjectId projectId = postponedRejections.keySet().iterator().next();
delivery.deliverNow(projectId, postponedRejections.get(projectId));
final PmCannotStartArchivedProject deliveredRejectionMsg = ReactingProjectWizard.getRejectionReceived();
assertNotNull(deliveredRejectionMsg);
assertEquals(getMessage(rejection), deliveredRejectionMsg);
}
Aggregations