Skip to content

Instantly share code, notes, and snippets.

@michalbujalski
Created December 27, 2018 22:24
Show Gist options
  • Save michalbujalski/4650927f63891b111d865e5a0d66bd31 to your computer and use it in GitHub Desktop.
Save michalbujalski/4650927f63891b111d865e5a0d66bd31 to your computer and use it in GitHub Desktop.
whenever(repository.fetchContacts()).thenReturn(emptyList()) //simulate interface response
verify(view).setData(any()) //verify `setData` method was called
verify(view, never()).setData(any()) //verify `setData` was never called
verify(view, times(2)).setData(any()) //verify `setData` was called exactly two times
...
//verify that `showProgress` and `getCurrentUser` were called in that exact order
val inOrder = inOrder(view,repository)
inOrder.verify(view).showProgress()
inOrder.verify(repository).getCurrentUser()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment