use of io.spine.test.aggregate.rejection.Rejections.AggCannotStartArchivedProject in project core-java by SpineEventEngine.
the class AggregateMessageDeliveryShould method postpone_rejections_dispatched_to_reactor_method.
@Test
public void postpone_rejections_dispatched_to_reactor_method() {
assertNull(ReactingProject.getEventReceived());
final Rejection rejection = cannotStartProject();
boundedContext.getRejectionBus().post(rejection);
assertNull(ReactingProject.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 AggCannotStartArchivedProject deliveredRejectionMsg = ReactingProject.getRejectionReceived();
assertNotNull(deliveredRejectionMsg);
assertEquals(getMessage(rejection), deliveredRejectionMsg);
}
Aggregations