use of io.spine.test.command.CreateProject in project core-java by SpineEventEngine.
the class CommandTestUtil method checkRecord.
static void checkRecord(CommandRecord record, Command cmd, CommandStatus statusExpected) {
final CommandContext context = cmd.getContext();
final CommandId commandId = cmd.getId();
final CreateProject message = unpack(cmd.getMessage());
assertEquals(cmd.getMessage(), record.getCommand().getMessage());
assertTrue(record.getTimestamp().getSeconds() > 0);
assertEquals(message.getClass().getSimpleName(), record.getCommandType());
assertEquals(commandId, record.getCommandId());
assertEquals(statusExpected, record.getStatus().getCode());
assertEquals(context, record.getCommand().getContext());
switch(statusExpected) {
case RECEIVED:
case OK:
case SCHEDULED:
assertTrue(isDefault(record.getStatus().getError()));
assertTrue(isDefault(record.getStatus().getFailure()));
break;
case ERROR:
assertTrue(isNotDefault(record.getStatus().getError()));
break;
case FAILURE:
assertTrue(isNotDefault(record.getStatus().getFailure()));
break;
case UNDEFINED:
case UNRECOGNIZED:
break;
}
}
use of io.spine.test.command.CreateProject in project core-java by SpineEventEngine.
the class CommandStoreShould method givenThrowingHandler.
private <E extends Throwable> Command givenThrowingHandler(E throwable) {
final CommandHandler handler = new ThrowingCreateProjectHandler(throwable);
commandBus.register(handler);
final CreateProject msg = createProjectMessage();
final Command command = requestFactory.command().create(msg);
return command;
}
Aggregations