Source:
<code>public void testCreateComment() { DocumentModel domain = session.createDocumentModel("/", "domain", "Domain"); domain = session.createDocument(domain); DocumentModel doc = session.createDocumentModel("/domain", "test", "File"); doc = session.createDocument(doc); session.save(); String author = "toto"; String text = "I am a comment !"; Comment comment = new CommentImpl(); comment.setAuthor(author); comment.setText(text); comment.setParentId("fakeId"); try { commentManager.createComment(session, comment); fail("Creating a comment should have failed !"); } catch (NuxeoException e) { assertEquals(404, e.getStatusCode()); <START> assertNotNull(e.getMessage()); <END> } comment.setParentId(doc.getId()); comment = commentManager.createComment(session, comment); assertEquals(author, comment.getAuthor()); assertEquals(text, comment.getText()); assertTrue(comment.getAncestorIds().contains(doc.getId())); DocumentModel commentModel = session.createDocumentModel(null, "Comment", COMMENT_DOC_TYPE); commentModel.setPropertyValue("dc:created", Calendar.getInstance()); Comments.commentToDocumentModel(comment, commentModel); commentModel = commentManager.createLocatedComment(doc, commentModel, FOLDER_COMMENT_CONTAINER); assertThat(session.getChildren(new PathRef(FOLDER_COMMENT_CONTAINER)).totalSize()).isEqualTo(1); Comment newComment = new CommentImpl(); newComment.setParentId(commentModel.getId()); commentManager.createComment(session, newComment); session.save(); assertEquals(2, commentManager.getComments(session, doc.getId()).size()); assertEquals(1, commentManager.getComments(session, commentModel.getId()).size()); assertThat(commentModel.getPathAsString()).contains(FOLDER_COMMENT_CONTAINER); }</code><technical_language>Is assert message a string</technical_language>

Target:
public void testCreateComment() { DocumentModel domain = session.createDocumentModel("/", "domain", "Domain"); domain = session.createDocument(domain); DocumentModel doc = session.createDocumentModel("/domain", "test", "File"); doc = session.createDocument(doc); session.save(); String author = "toto"; String text = "I am a comment !"; Comment comment = new CommentImpl(); comment.setAuthor(author); comment.setText(text); comment.setParentId("fakeId"); try { commentManager.createComment(session, comment); fail("Creating a comment should have failed !"); } catch (CommentNotFoundException e) { assertEquals(404, e.getStatusCode()); assertNotNull(e.getMessage()); } comment.setParentId(doc.getId()); comment = commentManager.createComment(session, comment); assertEquals(author, comment.getAuthor()); assertEquals(text, comment.getText()); assertTrue(comment.getAncestorIds().contains(doc.getId())); DocumentModel commentModel = session.createDocumentModel(null, "Comment", COMMENT_DOC_TYPE); commentModel.setPropertyValue("dc:created", Calendar.getInstance()); Comments.commentToDocumentModel(comment, commentModel); commentModel = commentManager.createLocatedComment(doc, commentModel, FOLDER_COMMENT_CONTAINER); assertThat(session.getChildren(new PathRef(FOLDER_COMMENT_CONTAINER)).totalSize()).isEqualTo(1); Comment newComment = new CommentImpl(); newComment.setParentId(commentModel.getId()); commentManager.createComment(session, newComment); session.save(); assertEquals(2, commentManager.getComments(session, doc.getId()).size()); assertEquals(1, commentManager.getComments(session, commentModel.getId()).size()); assertThat(commentModel.getPathAsString()).contains(FOLDER_COMMENT_CONTAINER); }