InputDialogPresenter implements InputDialog, InputDialogView.ActionDelegate { @Override public void accepted() { this.view.closeDialog(); if (this.inputCallback != null) { this.inputCallback.accepted(view.getValue()); } } @AssistedInject  InputDialogPresenter(final @NotNull InputDialogView view,
                                final @NotNull @Assisted("title") String title,
                                final @NotNull @Assisted("label") String label,
                                final @Nullable @Assisted InputCallback inputCallback,
                                final @Nullable @Assisted CancelCallback cancelCallback,
                                final UILocalizationConstant localizationConstant); @AssistedInject  InputDialogPresenter(final @NotNull InputDialogView view,
                                final @NotNull @Assisted("title") String title,
                                final @NotNull @Assisted("label") String label,
                                final @NotNull @Assisted("initialValue") String initialValue,
                                final @NotNull @Assisted("selectionStartIndex") Integer selectionStartIndex,
                                final @NotNull @Assisted("selectionLength") Integer selectionLength,
                                final @Nullable @Assisted InputCallback inputCallback,
                                final @Nullable @Assisted CancelCallback cancelCallback,
                                final UILocalizationConstant localizationConstant); @Override void cancelled(); @Override void accepted(); @Override void inputValueChanged(); @Override void onEnterClicked(); @Override void show(); @Override InputDialog withValidator(InputValidator inputValidator);  }
@Test public void shouldCallCallbackOnAccepted() throws Exception { presenter.accepted(); verify(view).closeDialog(); verify(view).getValue(); verify(inputCallback).accepted(anyString()); }
@Test public void shouldNotCallCallbackOnAccepted() throws Exception { presenter = new InputDialogPresenter(view, TITLE, MESSAGE, null, cancelCallback, localizationConstant); presenter.accepted(); verify(view).closeDialog(); verify(inputCallback, never()).accepted(anyString()); }