use of saulmm.avengers.entities.MarvelCharacter in project Avengers by saulmm.
the class CharacterListActivity method bindCharacterList.
@Override
public void bindCharacterList(List<MarvelCharacter> avengers) {
mCharacterListAdapter = new AvengersListAdapter(avengers, this, (position, sharedView, characterImageView) -> {
mAvengersListPresenter.onElementClick(position);
});
mAvengersRecycler.setAdapter(mCharacterListAdapter);
}
use of saulmm.avengers.entities.MarvelCharacter in project Avengers by saulmm.
the class ListPresenterTest method givenAFakeCharacterList.
private ArrayList<MarvelCharacter> givenAFakeCharacterList() {
ArrayList<MarvelCharacter> marvelCharacters = new ArrayList<>();
marvelCharacters.add(new MarvelCharacter("", -1));
marvelCharacters.add(new MarvelCharacter("", -1));
return marvelCharacters;
}
use of saulmm.avengers.entities.MarvelCharacter in project Avengers by saulmm.
the class ListPresenterTest method testThatCharactersArePassedToTheView.
@Test
public void testThatCharactersArePassedToTheView() throws Exception {
CharacterListPresenter listPresenter = givenAListPresenter();
ArrayList<MarvelCharacter> fakeCharacterList = givenAFakeCharacterList();
listPresenter.onCharactersReceived(fakeCharacterList);
verify(mockCharacterListView, times(1)).bindCharacterList(fakeCharacterList);
}
use of saulmm.avengers.entities.MarvelCharacter 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