use of saulmm.avengers.rest.utils.deserializers.MarvelResultsDeserializer in project Avengers by saulmm.
the class GsonDeserializersTest method testThatACollectionDeserialzierDeserializesACollection.
@Test
public void testThatACollectionDeserialzierDeserializesACollection() throws Exception {
MarvelResultsDeserializer<CollectionItem> marvelResultsDeserializer = new MarvelResultsDeserializer<>();
JsonElement collectionElement = new JsonParser().parse(getComicsCollectionJsonString());
Type t = new TypeToken<List<CollectionItem>>() {
}.getType();
List<CollectionItem> collectionList = marvelResultsDeserializer.deserialize(collectionElement, t, mock(JsonDeserializationContext.class));
assertThat(collectionList.isEmpty(), is(false));
assertNotNull(collectionList.get(0).getThumbnail());
}
use of saulmm.avengers.rest.utils.deserializers.MarvelResultsDeserializer in project Avengers by saulmm.
the class GsonDeserializersTest method testThatACharacterDeseralizersDeserializesACharacter.
@Test
public void testThatACharacterDeseralizersDeserializesACharacter() throws Exception {
MarvelResultsDeserializer<MarvelCharacter> marvelResultsDeserializer = new MarvelResultsDeserializer<>();
JsonElement characterElement = new JsonParser().parse(getCharacterJsonString());
Type t = new TypeToken<List<MarvelCharacter>>() {
}.getType();
List<MarvelCharacter> characterList = marvelResultsDeserializer.deserialize(characterElement, t, mock(JsonDeserializationContext.class));
assertThat(characterList.isEmpty(), is(false));
assertThat(characterList.get(0).getName(), is("3-D Man"));
}
Aggregations