use of io.grpc.testing.NoopClientCall in project grpc-java by grpc.
the class ClientCallsTest method unaryBlockingCallFailed.
@Test
public void unaryBlockingCallFailed() throws Exception {
Integer req = 2;
final Status status = Status.INTERNAL.withDescription("Unique status");
final Metadata trailers = new Metadata();
NoopClientCall<Integer, String> call = new NoopClientCall<Integer, String>() {
@Override
public void start(io.grpc.ClientCall.Listener<String> listener, Metadata headers) {
listener.onClose(status, trailers);
}
};
try {
ClientCalls.blockingUnaryCall(call, req);
fail("Should fail");
} catch (StatusRuntimeException e) {
assertSame(status, e.getStatus());
assertSame(trailers, e.getTrailers());
}
}
Aggregations