@Test public void saveDescriptionEditionTest() throws NoSuchFieldException { new FieldSetter(presenter, OverviewScreenPresenter.class.getDeclaredField("workspaceProject")).set(workspaceProject); new FieldSetter(presenter, OverviewScreenPresenter.class.getDeclaredField("changeRequestAuthorId")).set("admin"); doReturn("my updated description").when(view).getDescriptionInputText(); presenter.saveDescriptionEdition(); verify(changeRequestService).updateChangeRequestDescription(anyString(), anyString(), anyLong(), anyString()); }
public void saveDescriptionEdition() { if (isUserAuthor()) { final String descriptionInputText = view.getDescriptionInputText(); if (!isInvalidContent(descriptionInputText)) { changeRequestService.call(v -> { view.setDescription(descriptionInputText); view.enableDescriptionEditMode(false); }).updateChangeRequestDescription(workspaceProject.getSpace().getName(), workspaceProject.getRepository().getAlias(), currentChangeRequestId, descriptionInputText); } } }
OverviewScreenPresenter { public void saveDescriptionEdition() { if (isUserAuthor()) { final String descriptionInputText = view.getDescriptionInputText(); if (!isInvalidContent(descriptionInputText)) { changeRequestService.call(v -> { view.setDescription(descriptionInputText); view.enableDescriptionEditMode(false); }).updateChangeRequestDescription(workspaceProject.getSpace().getName(), workspaceProject.getRepository().getAlias(), currentChangeRequestId, descriptionInputText); } } } }
OverviewScreenPresenter { public void saveDescriptionEdition() { if (isUserAuthor()) { final String descriptionInputText = view.getDescriptionInputText(); if (!isInvalidContent(descriptionInputText)) { changeRequestService.call(v -> { view.setDescription(descriptionInputText); view.enableDescriptionEditMode(false); }).updateChangeRequestDescription(workspaceProject.getSpace().getName(), workspaceProject.getRepository().getAlias(), currentChangeRequestId, descriptionInputText); } } } @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 saveDescriptionEdition() { if (isUserAuthor()) { final String descriptionInputText = view.getDescriptionInputText(); if (!isInvalidContent(descriptionInputText)) { changeRequestService.call(v -> { view.setDescription(descriptionInputText); view.enableDescriptionEditMode(false); }).updateChangeRequestDescription(workspaceProject.getSpace().getName(), workspaceProject.getRepository().getAlias(), currentChangeRequestId, descriptionInputText); } } } @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 saveDescriptionEdition() { if (isUserAuthor()) { final String descriptionInputText = view.getDescriptionInputText(); if (!isInvalidContent(descriptionInputText)) { changeRequestService.call(v -> { view.setDescription(descriptionInputText); view.enableDescriptionEditMode(false); }).updateChangeRequestDescription(workspaceProject.getSpace().getName(), workspaceProject.getRepository().getAlias(), currentChangeRequestId, descriptionInputText); } } } @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);  }