use of io.grpc.stub.AbstractBlockingStubTest.NoopBlockingStub in project grpc-java by grpc.
the class AbstractBlockingStubTest method defaultCallOptions.
@Test
public void defaultCallOptions() {
NoopBlockingStub stub = NoopBlockingStub.newStub(new StubFactory<NoopBlockingStub>() {
@Override
public NoopBlockingStub newStub(Channel channel, CallOptions callOptions) {
return create(channel, callOptions);
}
}, channel, CallOptions.DEFAULT);
assertThat(stub.getCallOptions().getOption(ClientCalls.STUB_TYPE_OPTION)).isEqualTo(StubType.BLOCKING);
}
use of io.grpc.stub.AbstractBlockingStubTest.NoopBlockingStub in project grpc-java by grpc.
the class AbstractAsyncStubTest method newStub_blockingStub_throwsException.
@Test
@SuppressWarnings("AssertionFailureIgnored")
public void newStub_blockingStub_throwsException() {
try {
NoopBlockingStub unused = NoopAsyncStub.newStub(new StubFactory<NoopBlockingStub>() {
@Override
public NoopBlockingStub newStub(Channel channel, CallOptions callOptions) {
return new NoopBlockingStub(channel, callOptions);
}
}, channel, CallOptions.DEFAULT);
fail("should not reach here");
} catch (AssertionError e) {
assertThat(e).hasMessageThat().startsWith("Expected AbstractAsyncStub");
}
}
use of io.grpc.stub.AbstractBlockingStubTest.NoopBlockingStub in project grpc-java by grpc.
the class AbstractFutureStubTest method newStub_blockingStub_throwsException.
@Test
@SuppressWarnings("AssertionFailureIgnored")
public void newStub_blockingStub_throwsException() {
try {
NoopBlockingStub unused = NoopFutureStub.newStub(new StubFactory<NoopBlockingStub>() {
@Override
public NoopBlockingStub newStub(Channel channel, CallOptions callOptions) {
return new NoopBlockingStub(channel, callOptions);
}
}, channel, CallOptions.DEFAULT);
fail("should not reach here");
} catch (AssertionError e) {
assertThat(e).hasMessageThat().startsWith("Expected AbstractFutureStub");
}
}
Aggregations