use of io.spine.core.Command in project core-java by SpineEventEngine.
the class MultiTenantCommandBusShould method store_command_when_posted.
@Test
public void store_command_when_posted() {
commandBus.register(createProjectHandler);
final Command cmd = createProject();
commandBus.post(cmd, observer);
verify(commandStore).store(cmd);
}
use of io.spine.core.Command in project core-java by SpineEventEngine.
the class MultiTenantCommandBusShould method store_invalid_command_with_error_status.
@Test
public void store_invalid_command_with_error_status() {
commandBus.register(createProjectHandler);
final Command cmd = newCommandWithoutContext();
commandBus.post(cmd, observer);
verify(commandStore).store(eq(cmd), isA(Error.class));
}
use of io.spine.core.Command 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()));
}
use of io.spine.core.Command in project core-java by SpineEventEngine.
the class RecordsShould method convert_cmd_to_record.
/*
* Conversion tests.
*******************/
@Test
public void convert_cmd_to_record() {
final Command command = Given.ACommand.createProject();
final CommandStatus status = CommandStatus.RECEIVED;
final CommandRecord record = newRecordBuilder(command, status, null).build();
checkRecord(record, command, status);
}
use of io.spine.core.Command in project core-java by SpineEventEngine.
the class StorageShould method convert_cmd_to_record.
/*
* Conversion tests.
*******************/
@Test
public void convert_cmd_to_record() {
final Command command = Given.ACommand.createProject();
final CommandStatus status = RECEIVED;
final CommandRecord record = newRecordBuilder(command, status, null).build();
checkRecord(record, command, status);
}
Aggregations