ConfirmDialogPresenter implements ConfirmDialog, ConfirmDialogView.ActionDelegate { @Override public void accepted() { this.view.closeDialog(); if (this.confirmCallback != null) { this.confirmCallback.accepted(); } } @AssistedInject  ConfirmDialogPresenter(final @NotNull ConfirmDialogView view,
                                  final @NotNull @Assisted("title") String title,
                                  final @NotNull @Assisted("message") String message,
                                  final @Nullable @Assisted ConfirmCallback confirmCallback,
                                  final @Nullable @Assisted CancelCallback cancelCallback); @AssistedInject  ConfirmDialogPresenter(final @NotNull ConfirmDialogView view,
                                  final @NotNull @Assisted String title,
                                  final @NotNull @Assisted IsWidget content,
                                  final @Nullable @Assisted ConfirmCallback confirmCallback,
                                  final @Nullable @Assisted CancelCallback cancelCallback); @Override void cancelled(); @Override void accepted(); @Override void show();  }
@Test public void shouldCallCallbackOnAccepted() throws Exception { presenter.accepted(); verify(view).closeDialog(); verify(confirmCallback).accepted(); }
@Test public void shouldNotCallCallbackOnAccepted() throws Exception { presenter = new ConfirmDialogPresenter(view, TITLE, MESSAGE, null, cancelCallback); presenter.accepted(); verify(view).closeDialog(); verify(confirmCallback, never()).accepted(); }