### Question:
IssueManager { @Transactional(propagation = Propagation.REQUIRED) public IssueComment createComment(Long issueId, IssueCommentVO commentVO) { Issue issue = loadIssueAndCheckIfNotClosed(issueId); validateComment(commentVO); IssueComment comment = issueMapper.toIssueComment(commentVO); comment.setIssueId(issueId); comment.setAuthor(authManager.getAuthorizedUser()); commentDao.createComment(comment); commentVO.getAttachments().forEach(a -> attachmentDao.updateAttachmentCommentId(a.getId(), comment.getId())); notificationManager.notifyIssueComment(comment, issue, StringUtils.defaultIfBlank(commentVO.getHtmlText(), comment.getText())); return comment; }  @Transactional(propagation = Propagation.REQUIRED) Issue createIssue(IssueVO issueVO); Issue loadIssue(Long id); PagedResult<List<Issue>> loadMy(Long page, Integer pageSize); List<Issue> loadIssuesForEntity(EntityVO entityVO); @Transactional(propagation = Propagation.REQUIRED) Issue updateIssue(Long issueId, IssueVO issueVO); @Transactional(propagation = Propagation.REQUIRED) Issue deleteIssue(Long issueId); @Transactional(propagation = Propagation.REQUIRED) List<Issue> deleteIssuesForEntity(EntityVO entity); @Transactional(propagation = Propagation.REQUIRED) IssueComment createComment(Long issueId, IssueCommentVO commentVO); IssueComment loadComment(Long issueId, Long commentId); @Transactional(propagation = Propagation.REQUIRED) IssueComment updateComment(Long issueId, Long commentId, IssueCommentVO commentVO); @Transactional(propagation = Propagation.REQUIRED) IssueComment deleteComment(Long issueId, Long commentId);  }### Answer:
@Test public void testCreateComment() { Issue issue = registerIssue(); Long issueId = issue.getId(); IssueCommentVO commentVO = getCommentVO(COMMENT_TEXT); IssueComment comment = issueManager.createComment(issueId, commentVO); IssueComment loaded = issueManager.loadComment(issueId, comment.getId()); compareComments(comment, loaded); ArgumentCaptor<IssueComment> captor = ArgumentCaptor.forClass(IssueComment.class); ArgumentCaptor<String> htmlTextCaptor = ArgumentCaptor.forClass(String.class); verify(notificationManager).notifyIssueComment(captor.capture(), any(), htmlTextCaptor.capture()); assertEquals(COMMENT_TEXT, captor.getValue().getText()); assertEquals(COMMENT_TEXT, htmlTextCaptor.getValue()); }
@Test(expected = IllegalArgumentException.class) public void creatingCommentForNonExistentIssueShouldThrowException() { IssueCommentVO commentVO = getCommentVO(COMMENT_TEXT); Long nonExistentIssueId = 1L; issueManager.createComment(nonExistentIssueId, commentVO); }
@Test(expected = IllegalArgumentException.class) public void creatingCommentForClosedIssueShouldThrowException() { Issue issue = getClosedIssue(); IssueCommentVO commentVO = getCommentVO(COMMENT_TEXT); issueManager.createComment(issue.getId(), commentVO); }
@Test(expected = IllegalArgumentException.class) public void creatingCommentWithEmptyTextShouldThrowException() { Issue issue = registerIssue(); Long issueId = issue.getId(); IssueCommentVO commentVO = getCommentVO(""); issueManager.createComment(issueId, commentVO); }