use of io.spine.test.command.CmdCreateProject 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 CmdCreateProject 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().getRejection()));
break;
case ERROR:
assertTrue(isNotDefault(record.getStatus().getError()));
break;
case REJECTED:
assertTrue(isNotDefault(record.getStatus().getRejection()));
break;
case UNDEFINED:
case UNRECOGNIZED:
break;
}
}
use of io.spine.test.command.CmdCreateProject 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 CmdCreateProject msg = createProjectMessage();
final Command command = requestFactory.command().create(msg);
return command;
}
Aggregations