Search in sources :

Example 1 with ASTVariableOrConstantDeclarator

use of net.sourceforge.pmd.lang.plsql.ast.ASTVariableOrConstantDeclarator in project pmd by pmd.

the class StatementAndBraceFinderTest method testVariableOrConstantDeclaratorParentChildLinks.

@Test
public void testVariableOrConstantDeclaratorParentChildLinks() {
    ASTVariableOrConstantDeclarator vd = getOrderedNodes(ASTVariableOrConstantDeclarator.class, TEST2).get(0);
    // ASTMethodDeclaration vdParent = (ASTMethodDeclaration)
    // ((DataFlowNode) vd.getDataFlowNode().getParents().get(0)).getNode();
    ASTProgramUnit vdParent = (ASTProgramUnit) vd.getDataFlowNode().getParents().get(0).getNode();
    // Validate the two-way link between Program Unit and Variable
    assertEquals(vd, vdParent.getDataFlowNode().getChildren().get(0).getNode());
    assertEquals(vdParent, vd.getDataFlowNode().getParents().get(0).getNode());
}
Also used : ASTVariableOrConstantDeclarator(net.sourceforge.pmd.lang.plsql.ast.ASTVariableOrConstantDeclarator) ASTProgramUnit(net.sourceforge.pmd.lang.plsql.ast.ASTProgramUnit) Test(org.junit.Test)

Aggregations

ASTProgramUnit (net.sourceforge.pmd.lang.plsql.ast.ASTProgramUnit)1 ASTVariableOrConstantDeclarator (net.sourceforge.pmd.lang.plsql.ast.ASTVariableOrConstantDeclarator)1 Test (org.junit.Test)1