public static List<CaseComment> transformCaseComments(Collection<CommentInstance> caseComments) { List<CaseComment> comments = new ArrayList<>(); if (caseComments != null) { caseComments.forEach(c -> { String[] restrictions = new String[0]; if (c.getRestrictedTo() != null) { restrictions = c.getRestrictedTo().toArray(new String[c.getRestrictedTo().size()]); } comments.add(CaseComment.builder() .id(c.getId()) .author(c.getAuthor()) .addedAt(c.getCreatedAt()) .text(c.getComment()) .restrictedTo(restrictions) .build()); } ); } return comments; }
private CaseComment createTestComment() { CaseComment comment = CaseComment.builder() .id(commentId) .author(author) .text(text) .addedAt(new Date()) .build(); return comment; }
private CaseComment createTestComment() { CaseComment comment = CaseComment.builder() .id(commentId) .author(author) .text(text) .addedAt(new Date()) .build(); return comment; }
@Test public void testCaseCommentMapper_mapCaseComment() { final CaseComment cc = CaseComment.builder() .id("commentId") .author("admin") .text("commentText") .addedAt(new Date()) .build(); final CaseCommentSummary ccs = new CaseCommentMapper().apply(cc); assertCaseComment(cc, ccs); }
@Test public void testCaseCommentMapper_mapCaseComment() { final CaseComment cc = CaseComment.builder() .id("commentId") .author("admin") .text("commentText") .addedAt(new Date()) .build(); final CaseCommentSummary ccs = new CaseCommentMapper().apply(cc); assertCaseComment(cc, ccs); }