CommentUtil { @Deprecated public static String wordAfter(String text, int position) { if (text == null || position >= text.length()) { return null; } int newposition = position + 1; int end = newposition; char ch = text.charAt(end); while (Character.isLetterOrDigit(ch) && end < text.length()) { ch = text.charAt(++end); } return text.substring(newposition, end); } 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 testWordAfter() { String wordAfter = CommentUtil.wordAfter("@param param1 Description", "@param".length()); Assert.assertEquals("param1", wordAfter); }
@Test public void testWordAfterPositionOutOfBounds() { String wordAfter = CommentUtil.wordAfter("@param param1 Description", Integer.MAX_VALUE); Assert.assertNull(wordAfter); }
@Test public void testWordAfterNull() { String wordAfter = CommentUtil.wordAfter(null, 0); Assert.assertNull(wordAfter); }