use of io.grpc.Channel 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.Channel 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.Channel 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.Channel 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);
}
use of io.grpc.Channel 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");
}
}
Aggregations