@Test public void testRespFromJson() { RpcResponse<DirectoryBlockResponse> response = CONV.responseFromJson(DIRECTORY_BLOCK_RESP, DirectoryBlockResponse.class); Assert.assertNotNull(response); Assert.assertEquals("2.0", response.getJsonrpc()); Assert.assertEquals(3, response.getId()); Assert.assertNotNull(response.getResult()); DirectoryBlockResponse.Header header = response.getResult().getHeader(); Assert.assertNotNull(header); Assert.assertEquals("7d15d82e70201e960655ce3e7cf475c9da593dfb82c6dca6377349bd148bf001", header.getPreviousBlockKeyMR()); Assert.assertEquals(72497, header.getSequenceNumber()); Assert.assertEquals(1484858820, header.getTimestamp()); List<DirectoryBlockResponse.Entry> entries = response.getResult().getEntryblockList(); Assert.assertNotNull(entries); Assert.assertEquals(3, entries.size()); DirectoryBlockResponse.Entry entry = entries.get(1); Assert.assertEquals("000000000000000000000000000000000000000000000000000000000000000c", entry.getChainId()); Assert.assertEquals("5f8c98930a1874a46b47b65b9376a02fbff65b760f6866519799d69e2bc019ee", entry.getKeyMR()); }
@Override public <T> RpcResponse<T> responseFromJson(String json, Class<T> resultClass) { ParameterizedType parameterizedType = new ResolvedParameterizedType(RpcResponse.class, new Type[]{resultClass}); return jsonb().fromJson(json, parameterizedType); }
JsonConverterJEE implements JsonConverter { @Override public <T> RpcResponse<T> responseFromJson(String json, Class<T> resultClass) { ParameterizedType parameterizedType = new ResolvedParameterizedType(RpcResponse.class, new Type[]{resultClass}); return jsonb().fromJson(json, parameterizedType); } }
JsonConverterJEE implements JsonConverter { @Override public <T> RpcResponse<T> responseFromJson(String json, Class<T> resultClass) { ParameterizedType parameterizedType = new ResolvedParameterizedType(RpcResponse.class, new Type[]{resultClass}); return jsonb().fromJson(json, parameterizedType); }  }
JsonConverterJEE implements JsonConverter { @Override public <T> RpcResponse<T> responseFromJson(String json, Class<T> resultClass) { ParameterizedType parameterizedType = new ResolvedParameterizedType(RpcResponse.class, new Type[]{resultClass}); return jsonb().fromJson(json, parameterizedType); }  @Override void addAdapter(Type type, Object adapter); @Override JsonConverterJEE 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(); }
JsonConverterJEE implements JsonConverter { @Override public <T> RpcResponse<T> responseFromJson(String json, Class<T> resultClass) { ParameterizedType parameterizedType = new ResolvedParameterizedType(RpcResponse.class, new Type[]{resultClass}); return jsonb().fromJson(json, parameterizedType); }  @Override void addAdapter(Type type, Object adapter); @Override JsonConverterJEE 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; }