use of com.puppycrawl.tools.checkstyle.api.Comment in project checkstyle by checkstyle.
the class JavadocUtilTest method testTagType.
@Test
public void testTagType() {
final String[] text = { "/** @see block", " * {@link List inline}, {@link List#add(Object)}" };
final Comment comment = new Comment(text, 1, 2, text[1].length());
final JavadocTags blockTags = JavadocUtil.getJavadocTags(comment, JavadocUtil.JavadocTagType.BLOCK);
final JavadocTags inlineTags = JavadocUtil.getJavadocTags(comment, JavadocUtil.JavadocTagType.INLINE);
assertWithMessage("Invalid valid tags size").that(blockTags.getValidTags()).hasSize(1);
assertWithMessage("Invalid valid tags size").that(inlineTags.getValidTags()).hasSize(2);
}
use of com.puppycrawl.tools.checkstyle.api.Comment in project checkstyle by checkstyle.
the class JavadocUtilTest method testTagPositions.
@Test
public void testTagPositions() {
final String[] text = { "/** @see elsewhere", " also {@link Name value} */" };
final Comment comment = new Comment(text, 1, 2, text[1].length());
final List<JavadocTag> tags = JavadocUtil.getJavadocTags(comment, JavadocUtil.JavadocTagType.ALL).getValidTags();
assertWithMessage("Invalid tags size").that(tags).hasSize(2);
final JavadocTag seeTag = tags.get(0);
assertWithMessage("Invalid tag name").that(seeTag.getTagName()).isEqualTo(JavadocTagInfo.SEE.getName());
assertWithMessage("Invalid line number").that(seeTag.getLineNo()).isEqualTo(1);
assertWithMessage("Invalid column number").that(seeTag.getColumnNo()).isEqualTo(4);
final JavadocTag linkTag = tags.get(1);
assertWithMessage("Invalid tag name").that(linkTag.getTagName()).isEqualTo(JavadocTagInfo.LINK.getName());
assertWithMessage("Invalid line number").that(linkTag.getLineNo()).isEqualTo(2);
assertWithMessage("Invalid column number").that(linkTag.getColumnNo()).isEqualTo(10);
}
use of com.puppycrawl.tools.checkstyle.api.Comment in project checkstyle by checkstyle.
the class JavadocUtilTest method testInlineTagLinkText.
@Test
public void testInlineTagLinkText() {
final String[] text = { "/** {@link List link text }" };
final Comment comment = new Comment(text, 1, 1, text[0].length());
final List<JavadocTag> tags = JavadocUtil.getJavadocTags(comment, JavadocUtil.JavadocTagType.ALL).getValidTags();
assertWithMessage("Invalid first arg").that(tags.get(0).getFirstArg()).isEqualTo("List link text");
}
Aggregations