use of net.morimekta.test.providence.thrift.service.Request in project providence by morimekta.
the class BinarySerializerCompatibilityTest method testThriftToProvidence_simple.
@Test
public void testThriftToProvidence_simple() throws IOException {
Request request = new Request("test");
// Providence client talks to thrift service.
ByteArrayOutputStream baos = new ByteArrayOutputStream();
thrift.serialize(baos, request);
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
Request out = providence.deserialize(bais, Request.kDescriptor);
assertThat(out, equalToMessage(request));
}
use of net.morimekta.test.providence.thrift.service.Request 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