@Test public void shouldDeserializeAObject() throws Exception { UserTestModel userTestModelToDeserialize = fakeUserTestObject(); byte[] userDeserialized = fakeUserTestBytes(userTestModelToDeserialize); final ByteArrayInputStream bytesIn = new ByteArrayInputStream(userDeserialized); final UserTestModel value = valueMapper.read(UserTestModel.class, bytesIn); Assertions.assertThat(value).isNotNull(); Assertions.assertThat(value.getId()).isEqualTo(userTestModelToDeserialize.getId()); Assertions.assertThat(value.getName()).isEqualTo(userTestModelToDeserialize.getName()); }
@Override public <T> T read(Class<T> type, InputStream in) throws SerializerException { final InputStreamReader reader = new InputStreamReader(in); return gson.fromJson(reader, type); }
GsonValueMapper implements ValueMapper { @Override public <T> T read(Class<T> type, InputStream in) throws SerializerException { final InputStreamReader reader = new InputStreamReader(in); return gson.fromJson(reader, type); } }
GsonValueMapper implements ValueMapper { @Override public <T> T read(Class<T> type, InputStream in) throws SerializerException { final InputStreamReader reader = new InputStreamReader(in); return gson.fromJson(reader, type); } GsonValueMapper(Gson gson); }
GsonValueMapper implements ValueMapper { @Override public <T> T read(Class<T> type, InputStream in) throws SerializerException { final InputStreamReader reader = new InputStreamReader(in); return gson.fromJson(reader, type); } GsonValueMapper(Gson gson); @Override void write(Object value, OutputStream out); @Override T read(Class<T> type, InputStream in); }
GsonValueMapper implements ValueMapper { @Override public <T> T read(Class<T> type, InputStream in) throws SerializerException { final InputStreamReader reader = new InputStreamReader(in); return gson.fromJson(reader, type); } GsonValueMapper(Gson gson); @Override void write(Object value, OutputStream out); @Override T read(Class<T> type, InputStream in);  }