Forked from AndrienkoAleksandr/ArgumentCaptor with verify
Created
October 20, 2015 20:50
-
-
Save thiagomarinho/b113da3ac8acc2cec16a to your computer and use it in GitHub Desktop.
ArgumentCaptor
This file contains hidden or 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
ArgumentCaptor<UserChangedCallBack> userCapture = ArgumentCaptor.forClass(UserChangedCallBack.class); | |
usersListPresenter.onAddButtonClicked(); | |
verify(dialogBoxPresenter).showDialog(any(User.class), userCapture.capture()); | |
userCapture.getValue().onChanged(user); |
This file contains hidden or 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
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