Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thiagomarinho/b113da3ac8acc2cec16a to your computer and use it in GitHub Desktop.
Save thiagomarinho/b113da3ac8acc2cec16a to your computer and use it in GitHub Desktop.
ArgumentCaptor
ArgumentCaptor<UserChangedCallBack> userCapture = ArgumentCaptor.forClass(UserChangedCallBack.class);
usersListPresenter.onAddButtonClicked();
verify(dialogBoxPresenter).showDialog(any(User.class), userCapture.capture());
userCapture.getValue().onChanged(user);
doAnswer(new Answer() {
@Override
public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
UserChangedCallBack callBack = (UserChangedCallBack) invocationOnMock.getArguments()[1];
callBack.onChanged(userForDeleting);
return null;
}
}).when(dialogBoxPresenter).showDialog(any(User.class), any(UserChangedCallBack.class));
usersListPresenter.onAddButtonClicked();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment