Search in sources :

Example 1 with AggCannotStartArchivedProject

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);
}
Also used : Rejection(io.spine.core.Rejection) AggCannotStartArchivedProject(io.spine.test.aggregate.rejection.Rejections.AggCannotStartArchivedProject) ProjectId(io.spine.test.aggregate.ProjectId) PostponingRejectionDelivery(io.spine.server.aggregate.given.AggregateMessageDeliveryTestEnv.PostponingRejectionDelivery) RejectionEnvelope(io.spine.core.RejectionEnvelope) Test(org.junit.Test)

Aggregations

Rejection (io.spine.core.Rejection)1 RejectionEnvelope (io.spine.core.RejectionEnvelope)1 PostponingRejectionDelivery (io.spine.server.aggregate.given.AggregateMessageDeliveryTestEnv.PostponingRejectionDelivery)1 ProjectId (io.spine.test.aggregate.ProjectId)1 AggCannotStartArchivedProject (io.spine.test.aggregate.rejection.Rejections.AggCannotStartArchivedProject)1 Test (org.junit.Test)1