Search in sources :

Example 6 with Javadoc

use of com.github.javaparser.javadoc.Javadoc in project javaparser by javaparser.

the class JavadocParserTest method parseMultilineParamBlockTags.

@Test
public void parseMultilineParamBlockTags() {
    String text = EOL + "     * Add a field to this and automatically add the import of the type if needed" + EOL + "     *" + EOL + "     * @param typeClass the type of the field" + EOL + "     *     continued in a second line" + EOL + "     * @param name the name of the field" + EOL + "     * @param modifiers the modifiers like {@link Modifier#PUBLIC}" + EOL + "     * @return the {@link FieldDeclaration} created" + EOL + "     ";
    Javadoc res = JavadocParser.parse(text);
    assertEquals(new Javadoc(JavadocDescription.parseText("Add a field to this and automatically add the import of the type if needed")).addBlockTag(JavadocBlockTag.createParamBlockTag("typeClass", "the type of the field" + EOL + "    continued in a second line")).addBlockTag(JavadocBlockTag.createParamBlockTag("name", "the name of the field")).addBlockTag(JavadocBlockTag.createParamBlockTag("modifiers", "the modifiers like {@link Modifier#PUBLIC}")).addBlockTag(new JavadocBlockTag(JavadocBlockTag.Type.RETURN, "the {@link FieldDeclaration} created")), res);
}
Also used : Javadoc(com.github.javaparser.javadoc.Javadoc) JavadocBlockTag(com.github.javaparser.javadoc.JavadocBlockTag) Test(org.junit.Test)

Example 7 with Javadoc

use of com.github.javaparser.javadoc.Javadoc in project javaparser by javaparser.

the class JavadocParserTest method parseCommentWithIndentation.

@Test
public void parseCommentWithIndentation() {
    String text = "Returns a new Token object, by default." + EOL + "   * However, if you want, you can create and return subclass objects based on the value of ofKind." + EOL + "   *" + EOL + "   *    case MyParserConstants.ID : return new IDToken(ofKind, image);" + EOL + "   *" + EOL + "   * to the following switch statement. Then you can cast matchedToken";
    assertEquals(new Javadoc(JavadocDescription.parseText("Returns a new Token object, by default." + EOL + "However, if you want, you can create and return subclass objects based on the value of ofKind." + EOL + EOL + "   case MyParserConstants.ID : return new IDToken(ofKind, image);" + EOL + EOL + "to the following switch statement. Then you can cast matchedToken")), JavadocParser.parse(text));
}
Also used : Javadoc(com.github.javaparser.javadoc.Javadoc) Test(org.junit.Test)

Aggregations

Javadoc (com.github.javaparser.javadoc.Javadoc)7 Test (org.junit.Test)6 JavadocBlockTag (com.github.javaparser.javadoc.JavadocBlockTag)4