public void testEditReportingPeriodReviewCommentWithId() { Integer reportingPeriodId = 5; String newComment = "new Comment"; String userId = "userId"; Integer commentId = 2; AdverseEventReportingPeriod rp = Fixtures.createReportingPeriod(); ReportingPeriodReviewComment comment = Fixtures.createReportingPeriodReviewComment(1, "comment 1"); ArrayList<ReportingPeriodReviewComment> commentsList = new ArrayList<ReportingPeriodReviewComment>(); commentsList.add(comment); comment = Fixtures.createReportingPeriodReviewComment(2, "comment 2"); commentsList.add(comment); rp.setReviewComments(commentsList); EasyMock.expect(rpDao.getById(reportingPeriodId)).andReturn(rp); rpDao.modifyOrSaveReviewStatusAndComments(rp); replayMocks(); impl.editReportingPeriodReviewComment(reportingPeriodId, newComment, userId, commentId); verifyMocks(); assertEquals( "Edit comment isnt working correctly", "new Comment", rp.getReviewCommentsInternal().get(1).getUserComment()); }
public void testDeleteReportingPeriodReviewComment() { AdverseEventReportingPeriod rp = Fixtures.createReportingPeriod(); ArrayList<ReportingPeriodReviewComment> commentsList = new ArrayList<ReportingPeriodReviewComment>(); commentsList.add(Fixtures.createReportingPeriodReviewComment(1, "comment 1")); commentsList.add(Fixtures.createReportingPeriodReviewComment(2, "comment 2")); commentsList.add(Fixtures.createReportingPeriodReviewComment(3, "comment 3")); rp.setReviewComments(commentsList); rp.setId(1); EasyMock.expect(rpDao.getById(1)).andReturn(rp); rpDao.modifyOrSaveReviewStatusAndComments(rp); replayMocks(); impl.deleteReportingPeriodReviewComment(1, 2); verifyMocks(); assertEquals( "Comment not deleted from comments list", 2, rp.getReviewCommentsInternal().size()); }
public void testEditReportingPeriodReviewCommentWithoutObject() { String newComment = "new Comment"; String userId = "userId"; Integer commentId = 2; AdverseEventReportingPeriod rp = Fixtures.createReportingPeriod(); ReportingPeriodReviewComment comment = Fixtures.createReportingPeriodReviewComment(1, "comment 1"); ArrayList<ReportingPeriodReviewComment> commentsList = new ArrayList<ReportingPeriodReviewComment>(); commentsList.add(comment); comment = Fixtures.createReportingPeriodReviewComment(2, "comment 2"); commentsList.add(comment); rp.setReviewComments(commentsList); impl.editReportingPeriodReviewComment(rp, newComment, userId, commentId); assertEquals( "Edit comment isnt working correctly", "new Comment", rp.getReviewCommentsInternal().get(1).getUserComment()); }