use of io.spine.core.Status in project core-java by SpineEventEngine.
the class AbstractCommandBusTestSuite method checkCommandError.
static void checkCommandError(Ack sendingResult, CommandValidationError validationError, String errorType, Command cmd) {
final Status status = sendingResult.getStatus();
assertEquals(status.getStatusCase(), Status.StatusCase.ERROR);
final CommandId commandId = cmd.getId();
assertEquals(commandId, unpack(sendingResult.getMessageId()));
final Error error = status.getError();
assertEquals(errorType, error.getType());
assertEquals(validationError.getNumber(), error.getCode());
assertFalse(error.getMessage().isEmpty());
if (validationError == INVALID_COMMAND) {
assertFalse(error.getValidationError().getConstraintViolationList().isEmpty());
}
}
use of io.spine.core.Status in project core-java by SpineEventEngine.
the class Buses method reject.
/**
* Creates {@code Ack} response for the given message ID with the rejection status.
*
* @param id the ID of the message to provide with the status
* @param cause the cause of the message rejection
* @return the {@code Ack} response with the given message ID
*/
public static Ack reject(Message id, Rejection cause) {
checkNotNull(cause);
checkArgument(isNotDefault(cause));
final Status status = Status.newBuilder().setRejection(cause).build();
return setStatus(id, status);
}
Aggregations