Skip to content

Instantly share code, notes, and snippets.

@nbuesing
Last active December 26, 2015 04:08
Show Gist options
  • Save nbuesing/7090517 to your computer and use it in GitHub Desktop.
Save nbuesing/7090517 to your computer and use it in GitHub Desktop.
Mockito.doAnswer(new Answer() {
public Object answer(InvocationOnMock invocation) throws Throwable {
String msg = (String)invocation.getArguments()[0];
AsyncCallback callback = (AsyncCallback) invocation.getArguments()[1];
callback.onSuccess("Client said: \"" + msg + "\"<br>Server answered: \"Hi!\"");
return null;
}
}).when(sampleApplicationService).getMessage(Mockito.any(String.class), (AsyncCallback) Mockito.any());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment