RemotePresenter implements RemoteView.ActionDelegate { @Override public void onAddClicked() { addRemoteRepositoryPresenter.showDialog(new AsyncCallback<Void>() { @Override public void onSuccess(Void result) { getRemotes(); } @Override public void onFailure(Throwable caught) { String errorMessage = caught.getMessage() != null ? caught.getMessage() : constant.remoteAddFailed(); console.printError(errorMessage); Notification notification = new Notification(errorMessage, ERROR); notificationManager.showNotification(notification); } }); } @Inject  RemotePresenter(RemoteView view,
                           GitServiceClient service,
                           AppContext appContext,
                           GitLocalizationConstant constant,
                           AddRemoteRepositoryPresenter addRemoteRepositoryPresenter,
                           NotificationManager notificationManager,
                           DtoUnmarshallerFactory dtoUnmarshallerFactory,
                           GitOutputPartPresenter console); void showDialog(); @Override void onCloseClicked(); @Override void onAddClicked(); @Override void onDeleteClicked(); @Override void onRemoteSelected(Remote remote);  }
@Test public void testOnAddClicked() throws Exception { doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { Object[] arguments = invocation.getArguments(); AsyncCallback<Void> callback = (AsyncCallback<Void>)arguments[0]; callback.onSuccess(null); return callback; } }).when(addRemoteRepositoryPresenter).showDialog((AsyncCallback<Void>)anyObject()); presenter.onAddClicked(); verify(service).remoteList((ProjectDescriptor)anyObject(), anyString(), eq(SHOW_ALL_INFORMATION), (AsyncRequestCallback<List<Remote>>)anyObject()); verify(console, never()).printError(anyString()); verify(notificationManager, never()).showNotification((Notification)anyObject()); }