Search in sources :

Example 1 with InvalidProjectName

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()));
}
Also used : Rejections.toRejection(io.spine.core.Rejections.toRejection) Rejection(io.spine.core.Rejection) Command(io.spine.core.Command) InvalidProjectName(io.spine.test.reflect.InvalidProjectName) Ack(io.spine.core.Ack) Test(org.junit.Test)

Aggregations

Ack (io.spine.core.Ack)1 Command (io.spine.core.Command)1 Rejection (io.spine.core.Rejection)1 Rejections.toRejection (io.spine.core.Rejections.toRejection)1 InvalidProjectName (io.spine.test.reflect.InvalidProjectName)1 Test (org.junit.Test)1