GsonSerializationStrategy implements SerializationStrategy<T> { @Override public T deserialize(String serializedEntity) { return mGson.fromJson(serializedEntity, mType); } GsonSerializationStrategy(Gson gson, Class<T> type); @Override String serialize(T value); @Override T deserialize(String serializedEntity);  }
@Test public void shouldSuccessfullyDeserializeStringToJson() { String jsonString = getJsonString(); GsonSerializationStrategy<Cinema> serializationStrategy = getGsonSerializationStrategy(); Cinema cinema = serializationStrategy.deserialize(jsonString); assertNotNull(cinema); assertCinema(cinema); }
@Test public void shouldSuccessfullyDeserializeStringToList() { String jsonString = getJsonStrings(); GsonSerializationStrategy<Cinema[]> serializationStrategy = new GsonSerializationStrategy<>(new Gson(), Cinema[].class); List<Cinema> cinemas = Arrays.asList(serializationStrategy.deserialize(jsonString)); assertNotNull(cinemas); assertEquals(1, cinemas.size()); assertCinema(cinemas.get(0)); }