@Test public void addCommentInvalidTextTest() throws NoSuchFieldException { new FieldSetter(presenter, OverviewScreenPresenter.class.getDeclaredField("changeRequestAuthorId")).set("admin"); doReturn("").when(view).getCommentText(); presenter.addComment(); verify(changeRequestService, never()).addComment(anyString(), anyString(), anyLong(), anyString()); }
public void addComment() { final String commentText = view.getCommentText(); if (isInvalidContent(commentText)) { view.setCommentInputError(ts.getTranslation(LibraryConstants.MissingCommentText)); } else { changeRequestService.call(v -> { this.view.clearCommentInputError(); this.view.clearCommentInputField(); }).addComment(workspaceProject.getSpace().getName(), workspaceProject.getRepository().getAlias(), currentChangeRequestId, commentText); } }
OverviewScreenPresenter { public void addComment() { final String commentText = view.getCommentText(); if (isInvalidContent(commentText)) { view.setCommentInputError(ts.getTranslation(LibraryConstants.MissingCommentText)); } else { changeRequestService.call(v -> { this.view.clearCommentInputError(); this.view.clearCommentInputField(); }).addComment(workspaceProject.getSpace().getName(), workspaceProject.getRepository().getAlias(), currentChangeRequestId, commentText); } } }
OverviewScreenPresenter { public void addComment() { final String commentText = view.getCommentText(); if (isInvalidContent(commentText)) { view.setCommentInputError(ts.getTranslation(LibraryConstants.MissingCommentText)); } else { changeRequestService.call(v -> { this.view.clearCommentInputError(); this.view.clearCommentInputField(); }).addComment(workspaceProject.getSpace().getName(), workspaceProject.getRepository().getAlias(), currentChangeRequestId, commentText); } } @Inject  OverviewScreenPresenter(final View view,
                                   final TranslationService ts,
                                   final ManagedInstance<CommentItemPresenter> commentItemPresenterInstances,
                                   final Caller<ChangeRequestService> changeRequestService,
                                   final LibraryPlaces libraryPlaces,
                                   final ChangeRequestUtils changeRequestUtils,
                                   final SessionInfo sessionInfo); }
OverviewScreenPresenter { public void addComment() { final String commentText = view.getCommentText(); if (isInvalidContent(commentText)) { view.setCommentInputError(ts.getTranslation(LibraryConstants.MissingCommentText)); } else { changeRequestService.call(v -> { this.view.clearCommentInputError(); this.view.clearCommentInputField(); }).addComment(workspaceProject.getSpace().getName(), workspaceProject.getRepository().getAlias(), currentChangeRequestId, commentText); } } @Inject  OverviewScreenPresenter(final View view,
                                   final TranslationService ts,
                                   final ManagedInstance<CommentItemPresenter> commentItemPresenterInstances,
                                   final Caller<ChangeRequestService> changeRequestService,
                                   final LibraryPlaces libraryPlaces,
                                   final ChangeRequestUtils changeRequestUtils,
                                   final SessionInfo sessionInfo); @PostConstruct void postConstruct(); View getView(); void addComment(); void reset(); void setup(final ChangeRequest changeRequest,
                      final Consumer<Boolean> finishLoadingCallback); void checkWarnConflict(final ChangeRequest changeRequest); void startEditSummary(); void saveSummaryEdition(); void cancelSummaryEdition(); void startEditDescription(); void saveDescriptionEdition(); void cancelDescriptionEdition(); void nextCommentPage(); void prevCommentPage(); void setCommentCurrentPage(final int currentCommentPage); }
OverviewScreenPresenter { public void addComment() { final String commentText = view.getCommentText(); if (isInvalidContent(commentText)) { view.setCommentInputError(ts.getTranslation(LibraryConstants.MissingCommentText)); } else { changeRequestService.call(v -> { this.view.clearCommentInputError(); this.view.clearCommentInputField(); }).addComment(workspaceProject.getSpace().getName(), workspaceProject.getRepository().getAlias(), currentChangeRequestId, commentText); } } @Inject  OverviewScreenPresenter(final View view,
                                   final TranslationService ts,
                                   final ManagedInstance<CommentItemPresenter> commentItemPresenterInstances,
                                   final Caller<ChangeRequestService> changeRequestService,
                                   final LibraryPlaces libraryPlaces,
                                   final ChangeRequestUtils changeRequestUtils,
                                   final SessionInfo sessionInfo); @PostConstruct void postConstruct(); View getView(); void addComment(); void reset(); void setup(final ChangeRequest changeRequest,
                      final Consumer<Boolean> finishLoadingCallback); void checkWarnConflict(final ChangeRequest changeRequest); void startEditSummary(); void saveSummaryEdition(); void cancelSummaryEdition(); void startEditDescription(); void saveDescriptionEdition(); void cancelDescriptionEdition(); void nextCommentPage(); void prevCommentPage(); void setCommentCurrentPage(final int currentCommentPage);  }