TMTextUnitVariantCommentService { @Transactional public TMTextUnitVariantComment addComment( Long tmTextUnitVariantId, TMTextUnitVariantComment.Type type, TMTextUnitVariantComment.Severity severity, String content) { logger.debug("Add comment for tmTextUnitVariantId: {}, type: {}, severity: {}, status: {}, content: {}", tmTextUnitVariantId, type, severity, content); TMTextUnitVariantComment tmTextUnitVariantComment = new TMTextUnitVariantComment(); tmTextUnitVariantComment.setTmTextUnitVariant(tmTextUnitVariantRepository.getOne(tmTextUnitVariantId)); tmTextUnitVariantComment.setType(type); tmTextUnitVariantComment.setSeverity(severity); tmTextUnitVariantComment.setContent(content); tmTextUnitVariantComment = tmTextUnitVariantCommentRepository.save(tmTextUnitVariantComment); logger.debug("Comment added, id: {}", tmTextUnitVariantComment.getId()); return tmTextUnitVariantComment; }  void copyComments(Long sourceTmTextUnitVariantId, Long targetTMTextUnitVariantId); @Transactional TMTextUnitVariantComment addComment(
            Long tmTextUnitVariantId,
            TMTextUnitVariantComment.Type type,
            TMTextUnitVariantComment.Severity severity,
            String content); @Transactional TMTextUnitVariantComment addComment(
            TMTextUnitVariant tmTextUnitVariant,
            TMTextUnitVariantComment.Type type,
            TMTextUnitVariantComment.Severity severity,
            String content); List<TextUnitDTOWithComments> enrichTextUnitDTOsWithComments(List<TextUnitDTO> textUnitDTOs);  }
@Test public void testAddComment() { Long tmTextUnitVariantId = tmTestData.addCurrentTMTextUnitVariant1FrFR.getId(); List<TMTextUnitVariantComment> initialComments = tmTextUnitVariantCommentRepository.findAllByTmTextUnitVariant_id(tmTextUnitVariantId); Assert.assertEquals("There should be no comment in the TextUnitVariant", 0L, initialComments.size()); TMTextUnitVariantComment addComment = tmTextUnitVariantCommentService.addComment( tmTextUnitVariantId, TMTextUnitVariantComment.Type.LEVERAGING, TMTextUnitVariantComment.Severity.INFO, "for test"); List<TMTextUnitVariantComment> comments = tmTextUnitVariantCommentRepository.findAllByTmTextUnitVariant_id(tmTextUnitVariantId); Assert.assertEquals("There should be 1 comment in the TextUnitVariant", 1L, comments.size()); Assert.assertEquals("Comment should be the one just created", addComment.getId(), comments.get(0).getId()); Assert.assertEquals(TMTextUnitVariantComment.Type.LEVERAGING, comments.get(0).getType()); Assert.assertEquals(TMTextUnitVariantComment.Severity.INFO, comments.get(0).getSeverity()); Assert.assertEquals("for test", comments.get(0).getContent()); }