use of saulmm.avengers.mvp.presenters.CharacterListPresenter in project Avengers by saulmm.
the class ListPresenterTest method testThatPresenterShowsErrorWhenLoadingCharacters.
@Test
public void testThatPresenterShowsErrorWhenLoadingCharacters() throws Exception {
CharacterListPresenter listPresenter = givenAListPresenter();
when(mockGetCharacterUsecase.execute()).thenReturn(Observable.error(new Exception()));
listPresenter.askForCharacters();
verify(mockCharacterListView, times(1)).showUknownErrorMessage();
}
use of saulmm.avengers.mvp.presenters.CharacterListPresenter in project Avengers by saulmm.
the class ListPresenterTest method testThatPresenterRequestMoreCharacters.
@Test
public void testThatPresenterRequestMoreCharacters() throws Exception {
CharacterListPresenter listPresenter = givenAListPresenter();
when(mockGetCharacterUsecase.execute()).thenReturn(getFakeObservableCharacterList());
listPresenter.askForNewCharacters();
verify(mockGetCharacterUsecase, only()).execute();
}
use of saulmm.avengers.mvp.presenters.CharacterListPresenter in project Avengers by saulmm.
the class ListPresenterTest method testThatPresenterShowsALightErrorLoadingMoreCharacters.
@Test
public void testThatPresenterShowsALightErrorLoadingMoreCharacters() throws Exception {
CharacterListPresenter listPresenter = givenAListPresenter();
when(mockGetCharacterUsecase.execute()).thenReturn(Observable.error(new Exception()));
listPresenter.askForNewCharacters();
verify(mockCharacterListView, times(1)).showLightError();
}
use of saulmm.avengers.mvp.presenters.CharacterListPresenter in project Avengers by saulmm.
the class ListPresenterTest method givenAListPresenter.
private CharacterListPresenter givenAListPresenter() {
CharacterListPresenter listPresenter = new CharacterListPresenter(mockGetCharacterUsecase);
listPresenter.attachView(mockCharacterListView);
return listPresenter;
}
use of saulmm.avengers.mvp.presenters.CharacterListPresenter 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);
}
Aggregations