@Test public void setupIsAuthorTest() throws NoSuchFieldException { new FieldSetter(presenter, OverviewScreenPresenter.class.getDeclaredField("workspaceProject")).set(workspaceProject); ChangeRequest changeRequest = mock(ChangeRequest.class); doReturn("admin").when(changeRequest).getAuthorId(); presenter.setup(changeRequest, b -> { }); verify(view).showEditModes(true); }
public void setup(final ChangeRequest changeRequest, final Consumer<Boolean> finishLoadingCallback) { this.currentChangeRequestId = changeRequest.getId(); this.changeRequestAuthorId = changeRequest.getAuthorId(); this.view.setStatus(changeRequestUtils.formatStatus(changeRequest.getStatus())); this.view.setAuthor(changeRequest.getAuthorId()); this.view.setCreatedDate(changeRequestUtils.formatCreatedDate(changeRequest.getCreatedDate())); this.view.setSummary(changeRequest.getSummary()); this.view.setDescription(changeRequest.getDescription()); this.view.setSourceBranch(changeRequest.getSourceBranch()); this.view.setTargetBranch(changeRequest.getTargetBranch()); this.view.setCommentInputPlaceHolder(ts.getTranslation(LibraryConstants.LeaveAComment)); this.view.enableSummaryEditMode(false); this.view.enableDescriptionEditMode(false); this.view.showEditModes(isUserAuthor()); this.view.showRevertFailedTooltip(changeRequest.getStatus() == ChangeRequestStatus.REVERT_FAILED); this.refreshCommentList(finishLoadingCallback); }
OverviewScreenPresenter { public void setup(final ChangeRequest changeRequest, final Consumer<Boolean> finishLoadingCallback) { this.currentChangeRequestId = changeRequest.getId(); this.changeRequestAuthorId = changeRequest.getAuthorId(); this.view.setStatus(changeRequestUtils.formatStatus(changeRequest.getStatus())); this.view.setAuthor(changeRequest.getAuthorId()); this.view.setCreatedDate(changeRequestUtils.formatCreatedDate(changeRequest.getCreatedDate())); this.view.setSummary(changeRequest.getSummary()); this.view.setDescription(changeRequest.getDescription()); this.view.setSourceBranch(changeRequest.getSourceBranch()); this.view.setTargetBranch(changeRequest.getTargetBranch()); this.view.setCommentInputPlaceHolder(ts.getTranslation(LibraryConstants.LeaveAComment)); this.view.enableSummaryEditMode(false); this.view.enableDescriptionEditMode(false); this.view.showEditModes(isUserAuthor()); this.view.showRevertFailedTooltip(changeRequest.getStatus() == ChangeRequestStatus.REVERT_FAILED); this.refreshCommentList(finishLoadingCallback); } }
OverviewScreenPresenter { public void setup(final ChangeRequest changeRequest, final Consumer<Boolean> finishLoadingCallback) { this.currentChangeRequestId = changeRequest.getId(); this.changeRequestAuthorId = changeRequest.getAuthorId(); this.view.setStatus(changeRequestUtils.formatStatus(changeRequest.getStatus())); this.view.setAuthor(changeRequest.getAuthorId()); this.view.setCreatedDate(changeRequestUtils.formatCreatedDate(changeRequest.getCreatedDate())); this.view.setSummary(changeRequest.getSummary()); this.view.setDescription(changeRequest.getDescription()); this.view.setSourceBranch(changeRequest.getSourceBranch()); this.view.setTargetBranch(changeRequest.getTargetBranch()); this.view.setCommentInputPlaceHolder(ts.getTranslation(LibraryConstants.LeaveAComment)); this.view.enableSummaryEditMode(false); this.view.enableDescriptionEditMode(false); this.view.showEditModes(isUserAuthor()); this.view.showRevertFailedTooltip(changeRequest.getStatus() == ChangeRequestStatus.REVERT_FAILED); this.refreshCommentList(finishLoadingCallback); } @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 setup(final ChangeRequest changeRequest, final Consumer<Boolean> finishLoadingCallback) { this.currentChangeRequestId = changeRequest.getId(); this.changeRequestAuthorId = changeRequest.getAuthorId(); this.view.setStatus(changeRequestUtils.formatStatus(changeRequest.getStatus())); this.view.setAuthor(changeRequest.getAuthorId()); this.view.setCreatedDate(changeRequestUtils.formatCreatedDate(changeRequest.getCreatedDate())); this.view.setSummary(changeRequest.getSummary()); this.view.setDescription(changeRequest.getDescription()); this.view.setSourceBranch(changeRequest.getSourceBranch()); this.view.setTargetBranch(changeRequest.getTargetBranch()); this.view.setCommentInputPlaceHolder(ts.getTranslation(LibraryConstants.LeaveAComment)); this.view.enableSummaryEditMode(false); this.view.enableDescriptionEditMode(false); this.view.showEditModes(isUserAuthor()); this.view.showRevertFailedTooltip(changeRequest.getStatus() == ChangeRequestStatus.REVERT_FAILED); this.refreshCommentList(finishLoadingCallback); } @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 setup(final ChangeRequest changeRequest, final Consumer<Boolean> finishLoadingCallback) { this.currentChangeRequestId = changeRequest.getId(); this.changeRequestAuthorId = changeRequest.getAuthorId(); this.view.setStatus(changeRequestUtils.formatStatus(changeRequest.getStatus())); this.view.setAuthor(changeRequest.getAuthorId()); this.view.setCreatedDate(changeRequestUtils.formatCreatedDate(changeRequest.getCreatedDate())); this.view.setSummary(changeRequest.getSummary()); this.view.setDescription(changeRequest.getDescription()); this.view.setSourceBranch(changeRequest.getSourceBranch()); this.view.setTargetBranch(changeRequest.getTargetBranch()); this.view.setCommentInputPlaceHolder(ts.getTranslation(LibraryConstants.LeaveAComment)); this.view.enableSummaryEditMode(false); this.view.enableDescriptionEditMode(false); this.view.showEditModes(isUserAuthor()); this.view.showRevertFailedTooltip(changeRequest.getStatus() == ChangeRequestStatus.REVERT_FAILED); this.refreshCommentList(finishLoadingCallback); } @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);  }