use of net.morimekta.test.providence.thrift.service.MyService2 in project providence by morimekta.
the class SocketClientHandlerTest method testSimpleRequest_wrongMethod.
@Test
public void testSimpleRequest_wrongMethod() throws IOException, TException, Failure, InterruptedException {
when(impl.test(any(net.morimekta.test.thrift.thrift.service.Request.class))).thenThrow(new net.morimekta.test.thrift.thrift.service.Failure("failure"));
MyService2.Iface client = new MyService2.Client(new SocketClientHandler(serializer, address));
try {
client.testing(new Request(null));
fail("no exception");
} catch (PApplicationException e) {
assertThat(e.getId(), is(UNKNOWN_METHOD));
assertThat(e.getMessage(), is(equalTo("Invalid method name: 'testing'")));
}
Thread.sleep(10L);
verifyZeroInteractions(impl);
}
use of net.morimekta.test.providence.thrift.service.MyService2 in project providence by morimekta.
the class NonblockingSocketClientHandlerTest method testSimpleRequest_wrongMethod.
@Test
public void testSimpleRequest_wrongMethod() throws IOException, TException, Failure {
when(impl.test(any(net.morimekta.test.thrift.thrift.service.Request.class))).thenThrow(new net.morimekta.test.thrift.thrift.service.Failure("failure"));
try (NonblockingSocketClientHandler handler = new NonblockingSocketClientHandler(serializer, address)) {
MyService2.Iface client = new MyService2.Client(handler);
try {
client.testing(new Request("test"));
fail("no exception");
} catch (PApplicationException e) {
assertThat(e.getId(), is(UNKNOWN_METHOD));
assertThat(e.getMessage(), is(equalTo("Invalid method name: 'testing'")));
}
verifyZeroInteractions(impl);
}
}
Aggregations