use of net.sourceforge.pmd.lang.plsql.ast.ASTProgramUnit in project pmd by pmd.
the class StatementAndBraceFinderTest method testExpressionParentChildLinks.
/**
* Java ASTStatementExpression equivalent is inferred as an Expression()
* which has an UnlabelledStatement as a parent.
*/
@Test
public void testExpressionParentChildLinks() {
ASTExpression ex = getOrderedNodes(ASTExpression.class, TEST1).get(0);
DataFlowNode dfn = ex.getDataFlowNode();
assertEquals(3, dfn.getLine());
assertTrue(dfn.getNode() instanceof ASTExpression);
List<DataFlowNode> dfns = dfn.getParents();
assertEquals(1, dfns.size());
DataFlowNode parentDfn = dfns.get(0);
assertEquals(2, parentDfn.getLine());
assertTrue(parentDfn.getNode() instanceof ASTProgramUnit);
ASTProgramUnit exParent = (ASTProgramUnit) parentDfn.getNode();
// Validate the two-way link between Program Unit and Statement
assertEquals(ex, exParent.getDataFlowNode().getChildren().get(0).getNode());
assertEquals(exParent, ex.getDataFlowNode().getParents().get(0).getNode());
}
Aggregations