Last active
March 10, 2017 19:21
-
-
Save ragdroid/1c955ff24966710206c3a8791fcd8730 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Mock MainView mainViewMock; | |
@Mock PokeDataSource pokeDataSource; | |
@Mock HttpException httpException; | |
@Test | |
public void testDemoResponseError404() { | |
reset(mainViewMock); | |
MainPresenterImpl presenter = new MainPresenterImpl(schedulersProvider, pokeDataSource); | |
when(httpException.code()).thenReturn(HttpURLConnection.HTTP_NOT_FOUND); | |
when(pokeDataSource.getPokemonAbilityStringObservable(anyString())) | |
.thenReturn(Observable.<String>error(httpException)); | |
presenter.onViewAdded(mainViewMock, null); | |
testScheduler.triggerActions(); | |
verify(mainViewMock, times(1)).showErrorDialog("Lost!"); | |
verify(mainViewMock, times(0)).setApiText(anyString()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment