ConfirmDialogPresenter implements ConfirmDialog, ConfirmDialogView.ActionDelegate { @Override public void cancelled() { this.view.closeDialog(); if (this.cancelCallback != null) { this.cancelCallback.cancelled(); } } @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 shouldCallCallbackOnCanceled() throws Exception { presenter.cancelled(); verify(view).closeDialog(); verify(cancelCallback).cancelled(); }
@Test public void shouldNotCallCallbackOnCanceled() throws Exception { presenter = new ConfirmDialogPresenter(view, TITLE, MESSAGE, confirmCallback, null); presenter.cancelled(); verify(view).closeDialog(); verify(cancelCallback, never()).cancelled(); }