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