use of io.grpc.internal.ManagedChannelImplBuilder.ChannelBuilderDefaultPortProvider in project grpc-java by grpc.
the class ManagedChannelImplBuilderTest method getDefaultPort_custom.
/**
* Ensure getDefaultPort() delegates to the custom implementation.
*/
@Test
public void getDefaultPort_custom() {
int customPort = 43;
ChannelBuilderDefaultPortProvider mockChannelBuilderDefaultPortProvider = mock(ChannelBuilderDefaultPortProvider.class);
when(mockChannelBuilderDefaultPortProvider.getDefaultPort()).thenReturn(customPort);
builder = new ManagedChannelImplBuilder(DUMMY_TARGET, new UnsupportedClientTransportFactoryBuilder(), mockChannelBuilderDefaultPortProvider);
assertEquals(customPort, builder.getDefaultPort());
verify(mockChannelBuilderDefaultPortProvider).getDefaultPort();
}
Aggregations