use of net.morimekta.test.providence.thrift.service.Failure in project providence by morimekta.
the class SocketClientHandlerTest method testSimpleRequest_exception.
@Test
public void testSimpleRequest_exception() throws IOException, TException {
when(impl.test(any(net.morimekta.test.thrift.thrift.service.Request.class))).thenThrow(new net.morimekta.test.thrift.thrift.service.Failure("failure"));
MyService.Iface client = new MyService.Client(new SocketClientHandler(serializer, address));
try {
client.test(new Request(null));
fail("no exception");
} catch (Failure f) {
assertThat(f, is(equalToMessage(new Failure("failure"))));
}
}
use of net.morimekta.test.providence.thrift.service.Failure in project providence by morimekta.
the class NonblockingSocketClientHandlerTest method testSimpleRequest_exception.
@Test
public void testSimpleRequest_exception() throws IOException, TException {
when(impl.test(new net.morimekta.test.thrift.thrift.service.Request("test"))).thenThrow(new net.morimekta.test.thrift.thrift.service.Failure("failure"));
try (NonblockingSocketClientHandler handler = new NonblockingSocketClientHandler(serializer, address)) {
MyService.Iface client = new MyService.Client(handler);
try {
client.test(Request.builder().setText("test").build());
fail("no exception");
} catch (Failure f) {
assertThat(f, is(equalToMessage(new Failure("failure"))));
}
}
verify(impl).test(any(net.morimekta.test.thrift.thrift.service.Request.class));
}