Search in sources :

Example 1 with Failure

use of net.morimekta.test.providence.client.Failure in project providence by morimekta.

the class HttpClientHandlerTest method testSimpleRequest_exception.

@Test
public void testSimpleRequest_exception() throws IOException, Failure, TException {
    TestService.Iface client = new TestService.Client(new HttpClientHandler(this::endpoint, factory(), provider, instrumentation));
    when(impl.test(any(net.morimekta.test.thrift.client.Request.class))).thenThrow(new net.morimekta.test.thrift.client.Failure("failure"));
    try {
        client.test(new Request("request"));
        fail("No exception");
    } catch (Failure ex) {
        assertThat(ex.getText(), is("failure"));
    }
    verify(impl).test(any(net.morimekta.test.thrift.client.Request.class));
    verify(instrumentation).onComplete(anyDouble(), any(PServiceCall.class), any(PServiceCall.class));
    verifyNoMoreInteractions(impl, instrumentation);
}
Also used : TestService(net.morimekta.test.providence.client.TestService) HttpServletRequest(javax.servlet.http.HttpServletRequest) Request(net.morimekta.test.providence.client.Request) PServiceCall(net.morimekta.providence.PServiceCall) Failure(net.morimekta.test.providence.client.Failure) Test(org.junit.Test)

Aggregations

HttpServletRequest (javax.servlet.http.HttpServletRequest)1 PServiceCall (net.morimekta.providence.PServiceCall)1 Failure (net.morimekta.test.providence.client.Failure)1 Request (net.morimekta.test.providence.client.Request)1 TestService (net.morimekta.test.providence.client.TestService)1 Test (org.junit.Test)1