CommentUtil { @Deprecated public static List<String> multiLinesIn(String comment) { Token t = new Token(); t.image = comment; MultiLineComment node = new MultiLineComment(t); return Arrays.asList(Comment.NEWLINES_PATTERN.split(node.getFilteredComment())); } private  CommentUtil(); @Deprecated // will be removed with PMD 7.0.0 static String wordAfter(String text, int position); @Deprecated // will be removed with PMD 7.0.0 static String javadocContentAfter(String text, int position); @Deprecated // will be removed with PMD 7.0.0 static Map<String, Integer> javadocTagsIn(String comment); @Deprecated // will be removed with PMD 7.0.0 static List<String> multiLinesIn(String comment); @Deprecated // will be removed with PMD 7.0.0 static List<String> trim(List<String> lines);  }
@Test public void testMultiLinesInSingleLine() { String comment = ""; List<String> lines = CommentUtil.multiLinesIn(comment); Assert.assertEquals(1, lines.size()); Assert.assertEquals("single line.", lines.get(0)); }
@Test public void testMultiLinesInSingleLineSimple() { String comment = " List<String> lines = CommentUtil.multiLinesIn(comment); Assert.assertEquals(1, lines.size()); Assert.assertEquals("single line.", lines.get(0)); }
@Test public void testMultiLinesInSingleLineFormal() { String comment = ""; List<String> lines = CommentUtil.multiLinesIn(comment); Assert.assertEquals(1, lines.size()); Assert.assertEquals("single line.", lines.get(0)); }
@Test public void testMultiLinesInMultiLine() { String comment = "\n"; List<String> lines = CommentUtil.multiLinesIn(comment); Assert.assertEquals(2, lines.size()); Assert.assertEquals("line 1", lines.get(0)); Assert.assertEquals("line 2", lines.get(1)); }
@Test public void testMultiLinesInMultiLineCrLf() { String comment = "\r\n"; List<String> lines = CommentUtil.multiLinesIn(comment); Assert.assertEquals(2, lines.size()); Assert.assertEquals("line 1", lines.get(0)); Assert.assertEquals("line 2", lines.get(1)); }
@Test public void testMultiLinesInMultiLineFormal() { String comment = "\n"; List<String> lines = CommentUtil.multiLinesIn(comment); Assert.assertEquals(2, lines.size()); Assert.assertEquals("line 1", lines.get(0)); Assert.assertEquals("line 2", lines.get(1)); }
@Test public void testMultiLinesInMultiLineFormalCrLf() { String comment = "\r\n"; List<String> lines = CommentUtil.multiLinesIn(comment); Assert.assertEquals(2, lines.size()); Assert.assertEquals("line 1", lines.get(0)); Assert.assertEquals("line 2", lines.get(1)); }
@Test public void testMultiLinesInMultiLineNoAsteriskEmpty() { String comment = "\n"; List<String> lines = CommentUtil.multiLinesIn(comment); Assert.assertEquals(2, lines.size()); Assert.assertEquals("line 1", lines.get(0)); Assert.assertEquals("line 2", lines.get(1)); }