コード例 #1
0
 @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 =
       JavadocUtils.getJavadocTags(comment, JavadocUtils.JavadocTagType.BLOCK);
   final JavadocTags inlineTags =
       JavadocUtils.getJavadocTags(comment, JavadocUtils.JavadocTagType.INLINE);
   assertEquals(1, blockTags.getValidTags().size());
   assertEquals(2, inlineTags.getValidTags().size());
 }
コード例 #2
0
 @Test
 public void testInlineTagMethodRef() {
   final String[] text = {
     "/** {@link List#add(Object)}",
   };
   final Comment comment = new Comment(text, 1, 1, text[0].length());
   final List<JavadocTag> tags =
       JavadocUtils.getJavadocTags(comment, JavadocUtils.JavadocTagType.ALL).getValidTags();
   assertEquals("List#add(Object)", tags.get(0).getArg1());
 }
コード例 #3
0
 @Test
 public void testInvalidTags() {
   final String[] text = {
     "/** @fake block", " * {@bogus inline}", " * {@link List valid}",
   };
   final Comment comment = new Comment(text, 1, 3, text[2].length());
   final JavadocTags allTags =
       JavadocUtils.getJavadocTags(comment, JavadocUtils.JavadocTagType.ALL);
   assertEquals(2, allTags.getInvalidTags().size());
   assertEquals(1, allTags.getValidTags().size());
 }
コード例 #4
0
 @Test
 public void testTags() {
   final String[] text = {
     "/** @see elsewhere ",
     " * {@link List }, {@link List link text }",
     "   {@link List#add(Object) link text}",
     " * {@link Class link text}",
   };
   final Comment comment = new Comment(text, 1, 4, text[3].length());
   final JavadocTags allTags =
       JavadocUtils.getJavadocTags(comment, JavadocUtils.JavadocTagType.ALL);
   assertEquals(5, allTags.getValidTags().size());
 }
コード例 #5
0
  @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 =
        JavadocUtils.getJavadocTags(comment, JavadocUtils.JavadocTagType.ALL).getValidTags();

    assertEquals(2, tags.size());
    for (final JavadocTag tag : tags) {
      if (JavadocTagInfo.SEE.getName().equals(tag.getTagName())) {
        assertEquals(1, tag.getLineNo());
        assertEquals(5, tag.getColumnNo());
      } else if (JavadocTagInfo.LINK.getName().equals(tag.getTagName())) {
        assertEquals(2, tag.getLineNo());
        assertEquals(10, tag.getColumnNo());
      } else {
        fail("Unexpected tag: " + tag);
      }
    }
  }