use of io.spine.test.reflect.InvalidProjectName in project core-java by SpineEventEngine.
the class SingleTenantCommandBusShould method propagate_rejections_to_rejection_bus.
@Test
public void propagate_rejections_to_rejection_bus() {
final FaultyHandler faultyHandler = new FaultyHandler(eventBus);
commandBus.register(faultyHandler);
final Command addTaskCommand = clearTenantId(addTask());
final MemoizingObserver<Ack> observer = memoizingObserver();
commandBus.post(addTaskCommand, observer);
final InvalidProjectName throwable = faultyHandler.getThrowable();
final Rejection expectedRejection = toRejection(throwable, addTaskCommand);
final Ack ack = observer.firstResponse();
final Rejection actualRejection = ack.getStatus().getRejection();
assertTrue(isNotDefault(actualRejection));
assertEquals(unpack(expectedRejection.getMessage()), unpack(actualRejection.getMessage()));
}
Aggregations