GraphSONMessageSerializerV1d0 extends AbstractGraphSONMessageSerializerV1d0 implements MessageTextSerializer { @Override public RequestMessage deserializeRequest(final String msg) throws SerializationException { try { return mapper.readValue(msg, RequestMessage.class); } catch (Exception ex) { logger.warn("Request [{}] could not be deserialized by {}.", msg, AbstractGraphSONMessageSerializerV1d0.class.getName()); throw new SerializationException(ex); } } GraphSONMessageSerializerV1d0();  GraphSONMessageSerializerV1d0(final GraphSONMapper mapper); @Override String[] mimeTypesSupported(); @Override ResponseMessage deserializeResponse(final String msg); @Override String serializeResponseAsString(final ResponseMessage responseMessage); @Override RequestMessage deserializeRequest(final String msg); @Override String serializeRequestAsString(final RequestMessage requestMessage);  }
@Test public void shouldDeserializeRequestNicelyWithNoArgs() throws Exception { final UUID request = UUID.fromString("011CFEE9-F640-4844-AC93-034448AC0E80"); final RequestMessage m = SERIALIZER.deserializeRequest(String.format("{\"requestId\":\"%s\",\"op\":\"eval\"}", request)); assertEquals(request, m.getRequestId()); assertEquals("eval", m.getOp()); assertNotNull(m.getArgs()); assertEquals(0, m.getArgs().size()); }
@Test public void shouldDeserializeRequestNicelyWithArgs() throws Exception { final UUID request = UUID.fromString("011CFEE9-F640-4844-AC93-034448AC0E80"); final RequestMessage m = SERIALIZER.deserializeRequest(String.format("{\"requestId\":\"%s\",\"op\":\"eval\",\"args\":{\"x\":\"y\"}}", request)); assertEquals(request, m.getRequestId()); assertEquals("eval", m.getOp()); assertNotNull(m.getArgs()); assertEquals("y", m.getArgs().get("x")); }
@Test(expected = SerializationException.class) public void shouldDeserializeRequestParseMessage() throws Exception { SERIALIZER.deserializeRequest("{\"requestId\":\"%s\",\"op\":\"eval\",\"args\":{\"x\":\"y\"}}"); }