Search in sources :

Example 1 with ExternalMismatchSubscriber

use of io.spine.server.integration.given.IntegrationBusTestEnv.ExternalMismatchSubscriber in project core-java by SpineEventEngine.

the class IntegrationBusShould method throw_on_mismatch_of_external_attribute_during_dispatching.

@Test
public void throw_on_mismatch_of_external_attribute_during_dispatching() {
    final InMemoryTransportFactory transportFactory = InMemoryTransportFactory.newInstance();
    final BoundedContext sourceContext = contextWithTransport(transportFactory);
    final RejectionSubscriber rejectionSubscriber = new ExternalMismatchSubscriber();
    sourceContext.getRejectionBus().register(rejectionSubscriber);
    sourceContext.getIntegrationBus().register(rejectionSubscriber);
    final Rejection rejection = cannotStartArchivedProject();
    try {
        sourceContext.getRejectionBus().post(rejection);
        fail("An exception is expected.");
    } catch (Exception e) {
        final String exceptionMsg = e.getMessage();
        assertContains("external", exceptionMsg);
    }
}
Also used : Rejection(io.spine.core.Rejection) RejectionSubscriber(io.spine.server.rejection.RejectionSubscriber) ExternalMismatchSubscriber(io.spine.server.integration.given.IntegrationBusTestEnv.ExternalMismatchSubscriber) InMemoryTransportFactory(io.spine.server.integration.memory.InMemoryTransportFactory) BoundedContext(io.spine.server.BoundedContext) Test(org.junit.Test)

Aggregations

Rejection (io.spine.core.Rejection)1 BoundedContext (io.spine.server.BoundedContext)1 ExternalMismatchSubscriber (io.spine.server.integration.given.IntegrationBusTestEnv.ExternalMismatchSubscriber)1 InMemoryTransportFactory (io.spine.server.integration.memory.InMemoryTransportFactory)1 RejectionSubscriber (io.spine.server.rejection.RejectionSubscriber)1 Test (org.junit.Test)1