CommitPresenter implements CommitView.ActionDelegate { public void showDialog() { view.setAmend(false); view.setAllFilesInclude(false); view.setIncludeSelection(false); view.setOnlySelection(false); view.setEnableCommitButton(!view.getMessage().isEmpty()); view.showDialog(); view.focusInMessageField(); } @Inject  CommitPresenter(CommitView view,
                           GitServiceClient service,
                           GitLocalizationConstant constant,
                           GitOutputPartPresenter console,
                           NotificationManager notificationManager,
                           DtoUnmarshallerFactory dtoUnmarshallerFactory,
                           AppContext appContext,
                           DateTimeFormatter dateTimeFormatter,
                           final SelectionAgent selectionAgent); void showDialog(); @Override void onCommitClicked(); @Override void onCancelClicked(); @Override void onValueChanged(); @Override void setAmendCommitMessage();  }
@Test public void testShowDialog() throws Exception { when(view.getMessage()).thenReturn(EMPTY_TEXT); presenter.showDialog(); verify(view).setAmend(eq(!IS_OVERWRITTEN)); verify(view).setAllFilesInclude(eq(!ALL_FILE_INCLUDES)); verify(view).focusInMessageField(); verify(view).setEnableCommitButton(eq(DISABLE_BUTTON)); verify(view).getMessage(); verify(view).showDialog(); }
@Test public void testShowDialogWithExistingMessage() throws Exception { when(view.getMessage()).thenReturn("foo"); presenter.showDialog(); verify(view).setAmend(eq(!IS_OVERWRITTEN)); verify(view).setAllFilesInclude(eq(!ALL_FILE_INCLUDES)); verify(view).focusInMessageField(); verify(view).setEnableCommitButton(eq(ENABLE_BUTTON)); verify(view).getMessage(); verify(view).showDialog(); }