Search in sources :

Example 1 with MessageRejection

use of io.spine.core.MessageRejection in project core-java by SpineEventEngine.

the class StatusesShould method create_invalid_argument_status_exception.

@Test
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
public void create_invalid_argument_status_exception() {
    final MessageRejection rejection = new UnsupportedEventException(Sample.messageOfType(ProjectCreated.class));
    final StatusRuntimeException statusRuntimeEx = invalidArgumentWithCause(rejection);
    final Error actualError = MetadataConverter.toError(statusRuntimeEx.getTrailers()).get();
    assertEquals(Status.INVALID_ARGUMENT.getCode(), statusRuntimeEx.getStatus().getCode());
    assertEquals(rejection, statusRuntimeEx.getCause());
    assertEquals(rejection.asError(), actualError);
}
Also used : MessageRejection(io.spine.core.MessageRejection) StatusRuntimeException(io.grpc.StatusRuntimeException) Error(io.spine.base.Error) UnsupportedEventException(io.spine.server.event.UnsupportedEventException) ProjectCreated(io.spine.test.event.ProjectCreated) Test(org.junit.Test)

Aggregations

StatusRuntimeException (io.grpc.StatusRuntimeException)1 Error (io.spine.base.Error)1 MessageRejection (io.spine.core.MessageRejection)1 UnsupportedEventException (io.spine.server.event.UnsupportedEventException)1 ProjectCreated (io.spine.test.event.ProjectCreated)1 Test (org.junit.Test)1