JsonConverterGSON implements JsonConverter { @Override public RpcErrorResponse errorFromJson(String json) { return gson().fromJson(json, RpcErrorResponse.class); }  @Override void addAdapter(Type type, Object adapter); @Override JsonConverterGSON configure(Properties properties); @Override RpcErrorResponse errorFromJson(String json); @Override RpcResponse<T> responseFromJson(String json, Class<T> resultClass); @Override T fromJson(String json, Class<T> resultClass); @Override String prettyPrint(String json); @Override String toRpcJson(Object input); @Override String toGenericJson(Object object, Type runtimeType); @Override String getName(); static final String NAME; }
@Test public void testErrorFromJson() { RpcErrorResponse errorResponse = CONV.errorFromJson(METHOD_NOT_FOUND_RESP); Assert.assertNotNull(errorResponse); Assert.assertEquals("2.0", errorResponse.getJsonrpc()); Assert.assertEquals(51, errorResponse.getId()); Assert.assertNotNull(errorResponse.getError()); Assert.assertEquals(-32601, errorResponse.getError().getCode()); Assert.assertEquals("Method not found", errorResponse.getError().getMessage()); }