Skip to content

Instantly share code, notes, and snippets.

@michalbujalski
Last active January 21, 2019 06:48
Show Gist options
  • Save michalbujalski/6be9cd5148c29301068e1d371a15f033 to your computer and use it in GitHub Desktop.
Save michalbujalski/6be9cd5148c29301068e1d371a15f033 to your computer and use it in GitHub Desktop.
@Test
fun `fetch contacts, api error`(){
//given
val errorMessage = "Bad request"
whenver(api.fetchContacts()).thenReturn{Single.error(IllegalArgumentException(errorMessage)}
//when
presenter.fetchContacts()
//then
val inOrder = inOrder(view, api)
inOrder.verify(view).showProgress()
inOrder.verify(api).fetchContacts()
inOrder.verify(view).hideProgress()
inOrder.verify(view).showError(anyList)
inOrder.verifyNoMoreInteractions()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment