CaseCommentsPresenter extends AbstractCaseInstancePresenter<CaseCommentsPresenter.CaseCommentsView> { protected void updateCaseComment(final CaseCommentSummary caseCommentSummary, String caseCommentNewText) { caseService.call( (Void) -> refreshComments() ).updateComment(containerId, caseId, caseCommentSummary.getId(), identity.getIdentifier(), caseCommentNewText); }  int getPageSize(); void setCurrentPage(int i); int getCurrentPage(); @WorkbenchPartTitle String getTittle(); void refreshComments(); void loadMoreCaseComments(); void sortComments(final boolean sortAsc); static final String SCREEN_ID; static final int PAGE_SIZE; }
@Test public void testUpdateCaseComment() { String newCommentText = "newCommentText"; final CaseInstanceSummary cis = newCaseInstanceSummary(); when(identity.getIdentifier()).thenReturn(author); final CaseCommentSummary caseComment = CaseCommentSummary.builder().id(commentId).author(author).text(text).addedAt(addedAt).build(); when(caseManagementService.getComments(cis.getContainerId(), cis.getCaseId(), 0, presenter.getPageSize())).thenReturn(Collections.singletonList(caseComment)); setupCaseInstance(cis); presenter.updateCaseComment(caseComment, newCommentText); verify(caseManagementService).updateComment(eq(cis.getContainerId()), eq(cis.getCaseId()), eq(commentId), eq(author), eq(newCommentText)); verify(caseCommentsView, times(2)).setCaseCommentList(Collections.singletonList(caseComment)); verifyClearCaseInstance(2); }