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