use of net.morimekta.test.providence.client.Response in project providence by morimekta.
the class HttpClientHandlerTest method testSimpleRequest.
@Test
public void testSimpleRequest() throws IOException, TException, Failure {
TestService.Iface client = new TestService.Client(new HttpClientHandler(this::endpoint, factory(), provider, instrumentation));
when(impl.test(any(net.morimekta.test.thrift.client.Request.class))).thenReturn(new net.morimekta.test.thrift.client.Response("response"));
Response response = client.test(new Request("request"));
waitAtMost(Duration.ONE_HUNDRED_MILLISECONDS).until(() -> contentTypes.size() > 0);
verify(impl).test(any(net.morimekta.test.thrift.client.Request.class));
verify(instrumentation).onComplete(anyDouble(), any(PServiceCall.class), any(PServiceCall.class));
verifyNoMoreInteractions(impl, instrumentation);
assertThat(response, is(equalToMessage(new Response("response"))));
assertThat(contentTypes, is(equalTo(ImmutableList.of("application/vnd.apache.thrift.binary"))));
}
use of net.morimekta.test.providence.client.Response in project providence by morimekta.
the class HttpClientHandlerTest method testSimple.
@Test
public void testSimple() throws IOException, TException, Failure {
TestService.Iface client = new TestService.Client(new HttpClientHandler(this::endpoint));
when(impl.test(any(net.morimekta.test.thrift.client.Request.class))).thenReturn(new net.morimekta.test.thrift.client.Response("response"));
Response response = client.test(new Request("request"));
waitAtMost(Duration.ONE_HUNDRED_MILLISECONDS).until(() -> contentTypes.size() > 0);
verify(impl).test(any(net.morimekta.test.thrift.client.Request.class));
verifyNoMoreInteractions(impl);
assertThat(response, is(equalToMessage(new Response("response"))));
assertThat(contentTypes, is(equalTo(ImmutableList.of("application/vnd.apache.thrift.binary"))));
}
Aggregations