Example usage for org.eclipse.jdt.core.dom Javadoc toString

List of usage examples for org.eclipse.jdt.core.dom Javadoc toString

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom Javadoc toString.

Prototype

@Override
public final String toString() 

Source Link

Document

Returns a string representation of this node suitable for debugging purposes only.

Usage

From source file:de.akra.idocit.java.services.JavadocGeneratorTest.java

License:Apache License

/**
 * Tests {@link JavadocGenerator#appendDocsToJavadoc(List, String, String, Javadoc)} .
 * //from w ww. j a v  a 2s. co m
 * @throws IOException
 * @throws FileNotFoundException
 */
@SuppressWarnings("unchecked")
@Test
public void testGenerateJavadoc() throws FileNotFoundException, IOException {
    ParserOutput output = JavaTestUtils
            .createCompilationUnit(AllIDocItJavaTests.SOURCE_DIR + "ParsingService.java");
    CompilationUnit cu = output.getCompilationUnit();

    AbstractTypeDeclaration absTypeDecl = (AbstractTypeDeclaration) cu.types().get(0);
    AST ast = absTypeDecl.getAST();
    Javadoc javadoc = ast.newJavadoc();

    List<Documentation> documentations = createParamDocumentations();

    JavaMethod methodParam = new JavaMethod(SignatureElement.EMPTY_SIGNATURE_ELEMENT, "Method",
            "Searching Operations", Numerus.SINGULAR);

    for (Documentation documentation : documentations) {
        methodParam.addDocpart(documentation);
    }

    JavadocGenerator.INSTANCE.appendDocsToJavadoc(methodParam.getDocumentations(), null, null,
            "Searching Operations", javadoc, new ArrayList<TagElement>(), null);
    JavadocGenerator.INSTANCE.appendDocsToJavadoc(methodParam.getDocumentations(), TagElement.TAG_PARAM,
            "person", "Searching Operations", javadoc, new ArrayList<TagElement>(), null);

    JavaMethod methodReturn = new JavaMethod(SignatureElement.EMPTY_SIGNATURE_ELEMENT, "Method",
            "Searching Operations", Numerus.SINGULAR);

    for (Documentation documentation : createReturnDocumentations()) {
        methodReturn.addDocpart(documentation);
    }

    JavadocGenerator.INSTANCE.appendDocsToJavadoc(methodReturn.getDocumentations(), TagElement.TAG_RETURN, null,
            "Searching Operations", javadoc, new ArrayList<TagElement>(), null);

    TagElement tagElement = ast.newTagElement();
    tagElement.setTagName(JavadocParser.JAVADOC_TAG_THEMATICGRID);

    List<ASTNode> fragments = (List<ASTNode>) tagElement.fragments();
    TextElement textElement = ast.newTextElement();
    textElement.setText(" Searching Operations");
    fragments.add(textElement);

    List<TagElement> tags = javadoc.tags();
    tags.add(tagElement);

    Assert.assertEquals(EXPECTED_JAVADOC, javadoc.toString());
}

From source file:de.akra.idocit.java.services.JavadocParserTest.java

License:Apache License

/**
 * Test for {@link JavadocParser#parseIDocItJavadoc(Javadoc)}.
 * /*from  w  ww.  j a v  a 2s.c o m*/
 * @throws ParserConfigurationException
 * @throws IOException
 * @throws SAXException
 * @throws ParsingException 
 * 
 * @throws Exception
 */
@Test
public void testParse() throws SAXException, IOException, ParserConfigurationException, ParsingException {
    {
        AST a = AST.newAST(AST.JLS3);
        Javadoc javadoc = a.newJavadoc();

        List<Documentation> paramDocumentations = createParamDocumentations();
        List<Documentation> returnDocumentations = createReturnDocumentations();

        JavaMethod methodWithParams = new JavaMethod(SignatureElement.EMPTY_SIGNATURE_ELEMENT, "Method",
                "Searching Operations", Numerus.SINGULAR);

        for (Documentation documentation : paramDocumentations) {
            methodWithParams.addDocpart(documentation);
        }

        JavaMethod methodWithReturn = new JavaMethod(SignatureElement.EMPTY_SIGNATURE_ELEMENT, "Method",
                "Searching Operations", Numerus.SINGULAR);

        for (Documentation documentation : returnDocumentations) {
            methodWithReturn.addDocpart(documentation);
        }

        JavadocGenerator.INSTANCE.appendDocsToJavadoc(methodWithParams.getDocumentations(), null, null,
                "Searching Operations", javadoc, new ArrayList<TagElement>(), null);
        JavadocGenerator.INSTANCE.appendDocsToJavadoc(methodWithParams.getDocumentations(),
                TagElement.TAG_PARAM, "person", "Searching Operations", javadoc, new ArrayList<TagElement>(),
                null);
        JavadocGenerator.INSTANCE.appendDocsToJavadoc(methodWithReturn.getDocumentations(),
                TagElement.TAG_RETURN, null, "Searching Operations", javadoc, new ArrayList<TagElement>(),
                null);
        JavadocGenerator.INSTANCE.appendDocsToJavadoc(methodWithParams.getDocumentations(),
                TagElement.TAG_THROWS, "IllegalArgException", "Searching Operations", javadoc,
                new ArrayList<TagElement>(), null);

        // add the number of used documentations to this list, to make an assertion
        List<Documentation> allUsedDocs = new ArrayList<Documentation>(paramDocumentations.size() * 4);
        allUsedDocs.addAll(paramDocumentations);
        allUsedDocs.addAll(paramDocumentations);
        allUsedDocs.addAll(returnDocumentations);
        allUsedDocs.addAll(paramDocumentations);

        logger.log(Level.FINE, javadoc.toString());

        List<Documentation> convertedDocs = JavadocParser.INSTANCE.parseIDocItJavadoc(javadoc,
                TestUtils.createReferenceAddressees(), TestUtils.createReferenceThematicRoles(),
                methodWithParams);

        logger.log(Level.FINE, allUsedDocs.toString());
        logger.log(Level.FINE, convertedDocs.toString());

        Assert.assertEquals(allUsedDocs, convertedDocs);
    }
}

From source file:de.akra.idocit.java.services.SimpleJavadocGeneratorTest.java

License:Apache License

@Test
public void testAppendDocsToJavadoc() throws FileNotFoundException, IOException, ParsingException {
    /*// ww w.  j  a v a 2s  . c om
     * Positive tests
     */
    {
        // #########################################################################
        // # Test case #1: generate a simple Javadoc with four thematic roles. Some
        // # are within another taglet (e.g. in @param) and some are own taglets (e.g.
        // # like @source).
        // #########################################################################
        {
            final String referenceJavadoc = String.format(
                    "/** %1$s" + " * @orderingAlphabetically by lastname%1$s" + " * @sourceCRM System%1$s"
                            + " * %1$s" + " * @paramparameters [COMPARISON] This is the customer.%1$s"
                            + " * @paraminfoparameters [SOURCE] This is the source.%1$s"
                            + " * @subparamfirstName [COMPARISON]%1$s" + " * @subparamlastName [COMPARISON]%1$s"
                            + " * %1$s" + " * @return[OBJECT] This is the object.%1$s"
                            + " * @returninfo[SOURCE] This is the source.%1$s" + " * %1$s"
                            + " * @throwsIOException In case of an error%1$s"
                            + " * @throwsinfoIOException [ATTRIBUTE] This is also an attribute.%1$s"
                            + " * @thematicgridSearching Operations%1$s" + " */%1$s",
                    JAVADOC_NEW_LINE);

            final ParserOutput output = JavaTestUtils
                    .createCompilationUnit(AllIDocItJavaTests.SOURCE_DIR + "CustomerService.java");
            final CompilationUnit cu = output.getCompilationUnit();

            final JavaInterfaceArtifact artifact = TestDataFactory.createCustomerService("Developer", true, cu);

            JavaInterfaceGenerator.updateJavadocInAST(artifact, SimpleJavadocGenerator.INSTANCE);

            final JavaInterface customerServiceIntf = (JavaInterface) artifact.getInterfaces().get(0);
            final JavaMethod findCustomerByIdMeth = (JavaMethod) customerServiceIntf.getOperations().get(0);
            final Javadoc javadoc = findCustomerByIdMeth.getRefToASTNode().getJavadoc();

            assertEquals(referenceJavadoc, javadoc.toString());
        }

        // #########################################################################
        // # Test case #2: in case of an Checking Operation, the action is replaced
        // # by the rule.
        // #########################################################################
        {
            final String referenceJavadoc = String
                    .format("/** %1$s" + " * Rule: Maximum length of an address are 40 chars.%1$s" + " * %1$s"
                            + " * @ordering(" + Constants.ERROR_CASE_DOCUMENTATION_TEXT + ")%1$s" + " * %1$s"
                            + " * @parammailAddress [OBJECT]%1$s" + " * %1$s"
                            + " * @return[REPORT] <code>false</code> if the rule is violated%1$s"
                            + " * @thematicgridChecking Operations%1$s" + " */%1$s", JAVADOC_NEW_LINE);

            final ParserOutput output = JavaTestUtils
                    .createCompilationUnit(AllIDocItJavaTests.SOURCE_DIR + "InvariantService.java");
            final CompilationUnit cu = output.getCompilationUnit();

            final JavaInterfaceArtifact artifact = TestDataFactory.createInvariantService("Developer", cu,
                    true);

            JavaInterfaceGenerator.updateJavadocInAST(artifact, SimpleJavadocGenerator.INSTANCE);

            final JavaInterface invariantServiceIntf = (JavaInterface) artifact.getInterfaces().get(0);
            final JavaMethod checkInvariantMeth = (JavaMethod) invariantServiceIntf.getOperations().get(0);
            final Javadoc javadoc = checkInvariantMeth.getRefToASTNode().getJavadoc();

            assertEquals(referenceJavadoc, javadoc.toString());
        }

        // #########################################################################
        // # Test case #3: an artifact with empty documentation maps leads to no
        // # Javadoc.
        // #########################################################################
        {
            // This Java file is parsed to get a valid abstract syntax tree. We won't
            // use its Javadoc!
            final ParserOutput output = JavaTestUtils
                    .createCompilationUnit(AllIDocItJavaTests.SOURCE_DIR + "CustomerService.java");
            final CompilationUnit cu = output.getCompilationUnit();
            final JavaInterfaceArtifact customerService = TestDataFactory.createEmptyCustomerService(cu, true);

            JavaInterfaceGenerator.updateJavadocInAST(customerService, SimpleJavadocGenerator.INSTANCE);

            final JavaMethod methodFindCustById = (JavaMethod) customerService.getInterfaces().get(0)
                    .getOperations().get(0);

            assertEquals(createEmptyReferenceJDForCustomerService(),
                    methodFindCustById.getRefToASTNode().getJavadoc().toString());

        }

        // #########################################################################
        // # Test case #4: an artifact with null documentation maps leads to no
        // # Javadoc.
        // #########################################################################
        {
            // This Java file is parsed to get a valid abstract syntax tree. We won't
            // use its Javadoc!
            final ParserOutput output = JavaTestUtils
                    .createCompilationUnit(AllIDocItJavaTests.SOURCE_DIR + "CustomerService.java");
            final CompilationUnit cu = output.getCompilationUnit();
            final JavaInterfaceArtifact customerService = TestDataFactory.createNullCustomerService(cu, true);

            JavaInterfaceGenerator.updateJavadocInAST(customerService, SimpleJavadocGenerator.INSTANCE);

            final JavaMethod methodFindCustById = (JavaMethod) customerService.getInterfaces().get(0)
                    .getOperations().get(0);

            assertEquals(createEmptyReferenceJDForCustomerService(),
                    methodFindCustById.getRefToASTNode().getJavadoc().toString());
        }

        // #########################################################################
        // # Test case #5: @subparams must be followed by a path to the actual
        // # signature element and not only by the signature element's identifier.
        // #########################################################################
        {
            final String referenceJavadoc = String.format("/** %1$s"
                    + " * Only customers who placed an order within the last year are considered.%1$s"
                    + " * %1$s" + " * @orderingAlphabetically by lastname%1$s" + " * @sourceCRM System%1$s"
                    + " * %1$s" + " * @paramparameters%1$s" + " * @subparamcustomer.firstName [COMPARISON]%1$s"
                    + " * @subparamcustomer.lastName [COMPARISON]%1$s" + " * %1$s" + " * @return[OBJECT]%1$s"
                    + " * @subreturnfirstName [ATTRIBUTE] Won't be null, but could be an empty String%1$s"
                    + " * @subreturnlastName [ATTRIBUTE] Won't be null, but could be an empty String%1$s"
                    + " * %1$s" + " * @throwsSpecialException In case of an error%1$s"
                    + " * @thematicgridSearching Operations%1$s" + " */%1$s", JAVADOC_NEW_LINE);
            final ParserOutput output = JavaTestUtils
                    .createCompilationUnit(AllIDocItJavaTests.SOURCE_DIR + "CustomerService.java");
            final CompilationUnit cu = output.getCompilationUnit();

            final JavaInterfaceArtifact artifact = TestDataFactory.createCustomerService("Developer", true, cu);

            JavaInterfaceGenerator.updateJavadocInAST(artifact, SimpleJavadocGenerator.INSTANCE);

            final JavaInterface customerServiceIntf = (JavaInterface) artifact.getInterfaces().get(0);
            final JavaMethod findCustomerByIdMeth = (JavaMethod) customerServiceIntf.getOperations().get(1);
            final Javadoc javadoc = findCustomerByIdMeth.getRefToASTNode().getJavadoc();

            assertEquals(referenceJavadoc, javadoc.toString());
        }
    }

    // #########################################################################
    // #########################################################################

    /*
     * Negative tests
     */
    // #########################################################################
    // # Test case #1: documentations for Testers lead to an
    // # IllegalArgumentException.
    // #########################################################################
    {
        final ParserOutput output = JavaTestUtils
                .createCompilationUnit(AllIDocItJavaTests.SOURCE_DIR + "CustomerService.java");
        final CompilationUnit cu = output.getCompilationUnit();

        final JavaInterfaceArtifact customerService = TestDataFactory.createCustomerService("Tester", true, cu);

        {
            boolean illegalArgumentException = false;

            try {
                JavaInterfaceGenerator.updateJavadocInAST(customerService, SimpleJavadocGenerator.INSTANCE);
            } catch (IllegalArgumentException iaEx) {
                illegalArgumentException = true;
            }

            assertTrue(illegalArgumentException);
        }
    }
}

From source file:de.akra.idocit.java.services.SimpleJavadocGeneratorTest.java

License:Apache License

/**
 * Tests if the error case documentation is generated correctly. It is correct, if
 * first comes the {@link Constants#ERROR_CASE_DOCUMENTATION_TEXT} and then the
 * documentation text./*w  w  w .  j  av  a2s. co  m*/
 * 
 * @throws FileNotFoundException
 *             If the reference java-file {@link AllIDocItJavaTests#SOURCE_DIR}
 *             /InvariantService.java could not be found
 * @throws IOException
 *             If the reference java-file {@link AllIDocItJavaTests#SOURCE_DIR}
 *             /InvariantService.java could not be read
 * @throws ParsingException
 *             If the reference java-file {@link AllIDocItJavaTests#SOURCE_DIR}
 *             /InvariantService.java could not be parsed due to syntax errors
 */
@Test
public void testGenerateJavaDocErrorCaseWithDocumentation()
        throws FileNotFoundException, IOException, ParsingException {
    final String referenceJavadoc = String
            .format("/** %1$s" + " * Rule: Maximum length of an address are 40 chars.%1$s" + " * %1$s"
                    + " * @ordering(" + Constants.ERROR_CASE_DOCUMENTATION_TEXT + ") Ascending%1$s" + " * %1$s"
                    + " * @parammailAddress [OBJECT]%1$s" + " * %1$s"
                    + " * @return[REPORT] <code>false</code> if the rule is violated%1$s"
                    + " * @thematicgridChecking Operations%1$s" + " */%1$s", JAVADOC_NEW_LINE);

    final ParserOutput output = JavaTestUtils
            .createCompilationUnit(AllIDocItJavaTests.SOURCE_DIR + "InvariantService.java");
    final CompilationUnit cu = output.getCompilationUnit();

    final JavaInterfaceArtifact artifact = TestDataFactory
            .createInvariantService(AddresseeConstants.MOST_IMPORTANT_ADDRESSEE, cu, true);
    final Addressee addressee = DescribedItemUtils.findAddressee(AddresseeConstants.MOST_IMPORTANT_ADDRESSEE);
    List<Documentation> documentations = artifact.getInterfaces().get(0).getOperations().get(0)
            .getDocumentations();
    Documentation doc = DocumentationUtils.findDocumentationByRoleName("ORDERING", documentations);
    doc.getDocumentation().put(addressee, "Ascending");

    JavaInterfaceGenerator.updateJavadocInAST(artifact, SimpleJavadocGenerator.INSTANCE);

    final JavaInterface invariantServiceIntf = (JavaInterface) artifact.getInterfaces().get(0);
    final JavaMethod checkInvariantMeth = (JavaMethod) invariantServiceIntf.getOperations().get(0);
    final Javadoc javadoc = checkInvariantMeth.getRefToASTNode().getJavadoc();

    assertEquals(referenceJavadoc, javadoc.toString());
}

From source file:de.akra.idocit.java.services.SimpleJavadocGeneratorTest.java

License:Apache License

/**
 * Tests if the error case documentation is generated correctly. It is correct, if
 * first comes the {@link Constants#ERROR_CASE_DOCUMENTATION_TEXT} and then the
 * documentation text. It works even though there is an empty documentation string for
 * the "Tester".// w  w  w.  j a  va 2 s.c om
 * 
 * @throws FileNotFoundException
 *             If the reference java-file {@link AllIDocItJavaTests#SOURCE_DIR}
 *             /InvariantService.java could not be found
 * @throws IOException
 *             If the reference java-file {@link AllIDocItJavaTests#SOURCE_DIR}
 *             /InvariantService.java could not be read
 * @throws ParsingException
 *             If the reference java-file {@link AllIDocItJavaTests#SOURCE_DIR}
 *             /InvariantService.java could not be parsed due to syntax errors
 */
@Test
public void testAcceptEmptyDocsForNonDeveloperAddressees()
        throws FileNotFoundException, IOException, ParsingException {
    final String referenceJavadoc = String
            .format("/** %1$s" + " * Rule: Maximum length of an address are 40 chars.%1$s" + " * %1$s"
                    + " * @ordering(" + Constants.ERROR_CASE_DOCUMENTATION_TEXT + ") Ascending%1$s" + " * %1$s"
                    + " * @parammailAddress [OBJECT]%1$s" + " * %1$s"
                    + " * @return[REPORT] <code>false</code> if the rule is violated%1$s"
                    + " * @thematicgridChecking Operations%1$s" + " */%1$s", JAVADOC_NEW_LINE);

    final ParserOutput output = JavaTestUtils
            .createCompilationUnit(AllIDocItJavaTests.SOURCE_DIR + "InvariantService.java");
    final CompilationUnit cu = output.getCompilationUnit();

    final JavaInterfaceArtifact artifact = TestDataFactory
            .createInvariantService(AddresseeConstants.MOST_IMPORTANT_ADDRESSEE, cu, true);
    final Addressee addressee = DescribedItemUtils.findAddressee(AddresseeConstants.MOST_IMPORTANT_ADDRESSEE);
    List<Documentation> documentations = artifact.getInterfaces().get(0).getOperations().get(0)
            .getDocumentations();
    Documentation doc = DocumentationUtils.findDocumentationByRoleName("ORDERING", documentations);
    doc.getDocumentation().put(addressee, "Ascending");

    final Addressee tester = DescribedItemUtils.findAddressee("Tester");
    doc.getDocumentation().put(tester, "  \t  ");

    JavaInterfaceGenerator.updateJavadocInAST(artifact, SimpleJavadocGenerator.INSTANCE);

    final JavaInterface invariantServiceIntf = (JavaInterface) artifact.getInterfaces().get(0);
    final JavaMethod checkInvariantMeth = (JavaMethod) invariantServiceIntf.getOperations().get(0);
    final Javadoc javadoc = checkInvariantMeth.getRefToASTNode().getJavadoc();

    assertEquals(referenceJavadoc, javadoc.toString());
}

From source file:de.akra.idocit.java.services.SimpleJavadocGeneratorTest.java

License:Apache License

/**
 * If there is a '>' or '<' in the documentation-text, these characters must be quoted.
 *  /*ww w . j  a  va  2s.  c o m*/
 * @throws FileNotFoundException
 *             If the reference java-file {@link AllIDocItJavaTests#SOURCE_DIR}
 *             /InvariantService.java could not be found
 * @throws IOException
 *             If the reference java-file {@link AllIDocItJavaTests#SOURCE_DIR}
 *             /InvariantService.java could not be read
 * @throws ParsingException
 *             If the reference java-file {@link AllIDocItJavaTests#SOURCE_DIR}
 *             /InvariantService.java could not be parsed due to syntax errors
 */
@Test
public void testXmlBracketsInDocumentationText() throws FileNotFoundException, IOException, ParsingException {
    final String referenceJavadoc = String
            .format("/** %1$s" + " * Rule: Maximum length of an address are 40 chars.%1$s" + " * %1$s"
                    + " * @ordering(" + Constants.ERROR_CASE_DOCUMENTATION_TEXT
                    + ") Ascending &lt;&gt;<br/>%1$s" + " *  Test y &lt;= x<br/>%1$s" + " *  Test y &gt;= x%1$s"
                    + " * %1$s" + " * @parammailAddress [OBJECT]%1$s" + " * %1$s"
                    + " * @return[REPORT] <code>false</code> if the rule is violated%1$s"
                    + " * @thematicgridChecking Operations%1$s" + " */%1$s", JAVADOC_NEW_LINE);

    final ParserOutput output = JavaTestUtils
            .createCompilationUnit(AllIDocItJavaTests.SOURCE_DIR + "InvariantService.java");
    final CompilationUnit cu = output.getCompilationUnit();

    final JavaInterfaceArtifact artifact = TestDataFactory
            .createInvariantService(AddresseeConstants.MOST_IMPORTANT_ADDRESSEE, cu, true);
    final Addressee addressee = DescribedItemUtils.findAddressee(AddresseeConstants.MOST_IMPORTANT_ADDRESSEE);
    List<Documentation> documentations = artifact.getInterfaces().get(0).getOperations().get(0)
            .getDocumentations();
    Documentation doc = DocumentationUtils.findDocumentationByRoleName("ORDERING", documentations);
    // HERE WE HAVE THE '<' and '>' characters!!!
    doc.getDocumentation().put(addressee, "Ascending <>\n Test y <= x\n Test y >= x");

    final Addressee tester = DescribedItemUtils.findAddressee("Tester");
    doc.getDocumentation().put(tester, "  \t  ");

    JavaInterfaceGenerator.updateJavadocInAST(artifact, SimpleJavadocGenerator.INSTANCE);

    final JavaInterface invariantServiceIntf = (JavaInterface) artifact.getInterfaces().get(0);
    final JavaMethod checkInvariantMeth = (JavaMethod) invariantServiceIntf.getOperations().get(0);
    final Javadoc javadoc = checkInvariantMeth.getRefToASTNode().getJavadoc();

    assertEquals(referenceJavadoc, javadoc.toString());
}

From source file:de.akra.idocit.java.services.SimpleJavadocGeneratorTest.java

License:Apache License

/**
 * Test if the role ACTION or RULE is always at first position in the Javadoc comment.
 * /*w ww  .  ja va2s .  c  o  m*/
 * @throws FileNotFoundException
 * @throws IOException
 * @throws ParsingException
 */
@Test
public void testCorrectJavadocTagOrdering() throws FileNotFoundException, IOException, ParsingException {
    final String[] referenceJavadocs = new String[] {
            /*
             * Test 1: with thematic role ACTION
             */
            String.format("/** %1$s" + " * The Action%1$s" + " * %1$s" + " * @sourceThe Source%1$s" + " * %1$s"
                    + " * @returnString%1$s" + " * @thematicgridGetting Operations / Getter%1$s" + " */%1$s",
                    JAVADOC_NEW_LINE),

            /*
             * Test 2: with thematic role RULE
             */
            String.format(
                    "/** %1$s" + " * Rule: The rule%1$s" + " * %1$s" + " * @sourceThe Source%1$s" + " * %1$s"
                            + " * @returnString%1$s" + " * @thematicgridChecking Operations%1$s" + " */%1$s",
                    JAVADOC_NEW_LINE) };

    for (int i = 0; i < referenceJavadocs.length; ++i) {
        final ParserOutput output = JavaTestUtils
                .createCompilationUnit(AllIDocItJavaTests.SOURCE_DIR + "TestInterface1.java");
        final CompilationUnit cu = output.getCompilationUnit();

        final JavaInterfaceArtifact artifact = TestDataFactory.createTestInterface1(TestUtils.createDeveloper(),
                cu, true, i);

        JavaInterfaceGenerator.updateJavadocInAST(artifact, SimpleJavadocGenerator.INSTANCE);

        final JavaInterface testIntf1 = (JavaInterface) artifact.getInterfaces().get(0);
        final JavaMethod getStringMeth = (JavaMethod) testIntf1.getOperations().get(0);
        final Javadoc javadoc = getStringMeth.getRefToASTNode().getJavadoc();

        assertEquals(referenceJavadocs[i], javadoc.toString());
    }

}

From source file:edu.buffalo.cse.green.editor.controller.MemberPart.java

License:Open Source License

/**
 * @param doc - The <code>Javadoc</code>.
 * @return The javadoc String from the given <code>Javadoc</code>.
 *///from   ww  w. j a v  a  2s . c  om
protected String getDoc(Javadoc doc) {
    if (doc == null) {
        return "";
    }

    return doc.toString();
}

From source file:org.ebayopensource.dsf.javatojs.translate.custom.dom.JsNativeCustomTranslator.java

License:Open Source License

private void processMethodJavadoc(MethodDeclaration astMtd, JstMethod jstMtd) {
    Javadoc javadoc = astMtd.getJavadoc();
    if (javadoc == null) {
        return;/*from  w ww . j  a  va  2s. c om*/
    }
    JstDoc jstDoc = new JstDoc(cleanUpDoc(javadoc.toString()));
    jstMtd.setDoc(jstDoc);
}

From source file:org.ebayopensource.dsf.javatojs.translate.custom.dom.JsNativeCustomTranslator.java

License:Open Source License

private void processFieldJavadoc(MethodDeclaration astMtd, JstProperty pty) {
    Javadoc javadoc = astMtd.getJavadoc();
    if (javadoc == null) {
        return;//from  w  ww. j av a  2  s  .co  m
    }
    String jsdoc = cleanUpDoc(javadoc.toString());
    JstDoc jstDoc = new JstDoc(jsdoc);
    pty.setDoc(jstDoc);
}