use of io.servicetalk.grpc.api.GrpcStatus in project servicetalk by apple.
the class ProtocolCompatibilityTest method assertStatusRuntimeException.
private static void assertStatusRuntimeException(final StatusRuntimeException statusException, final boolean withStatus, final Status.Code expectStatusCode, @Nullable final String expectMessage) throws InvalidProtocolBufferException {
final Status grpcStatus = statusException.getStatus();
assertNotNull(grpcStatus);
assertEquals(expectStatusCode.value(), grpcStatus.getCode().value());
if (null != expectMessage) {
assertEquals(expectMessage, grpcStatus.getDescription());
}
final com.google.rpc.Status status = StatusProto.fromThrowable(statusException);
if (withStatus) {
assertNotNull(status);
assertEquals(grpcStatus.getCode().value(), status.getCode());
assertStatus(status, expectStatusCode.value(), grpcStatus.getDescription());
} else {
if (null != status) {
assertFallbackStatus(status, expectStatusCode.value(), grpcStatus.getDescription());
}
}
}
use of io.servicetalk.grpc.api.GrpcStatus in project servicetalk by apple.
the class ProtocolCompatibilityTest method assertGrpcStatusException.
private static void assertGrpcStatusException(final GrpcStatusException statusException, final boolean withStatus, final GrpcStatusCode expectStatusCode, @Nullable final String expectMessage) throws InvalidProtocolBufferException {
final GrpcStatus grpcStatus = statusException.status();
assertNotNull(grpcStatus);
assertEquals(expectStatusCode, grpcStatus.code(), "grpcStatus: " + grpcStatus);
if (null != expectMessage) {
assertEquals(expectMessage, grpcStatus.description());
}
final com.google.rpc.Status status = statusException.applicationStatus();
if (withStatus) {
assertNotNull(status);
assertEquals(grpcStatus.code().value(), status.getCode());
assertStatus(status, expectStatusCode.value(), grpcStatus.description());
} else {
if (null != status) {
assertFallbackStatus(status, expectStatusCode.value(), grpcStatus.description());
}
}
}
Aggregations