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);
}
}
Aggregations