diff --git a/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/XMLTableTest.java b/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/XMLTableTest.java index 25d129b1fd..ced763b904 100644 --- a/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/XMLTableTest.java +++ b/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/XMLTableTest.java @@ -4,14 +4,30 @@ package net.sourceforge.pmd.lang.plsql.ast; +import java.util.List; + +import org.junit.Assert; import org.junit.Test; import net.sourceforge.pmd.lang.plsql.AbstractPLSQLParserTst; + public class XMLTableTest extends AbstractPLSQLParserTst { @Test public void testParseXMLTable() { - plsql.parseResource("XMLTable.pls"); + ASTInput node = plsql.parseResource("XMLTable.pls"); + + List functions = node.findDescendantsOfType(ASTFunctionCall.class); + ASTFunctionCall xmlforest = functions.get(functions.size() - 1); + Assert.assertEquals("XMLFOREST", xmlforest.getImage()); + Assert.assertEquals("e.employee_id", xmlforest.getChild(1).getImage()); + Assert.assertEquals("foo", xmlforest.getChild(2).getImage()); + Assert.assertTrue(xmlforest.getChild(2) instanceof ASTID); + Assert.assertEquals("e.last_name", xmlforest.getChild(3).getImage()); + Assert.assertEquals("last_name", xmlforest.getChild(4).getImage()); + Assert.assertTrue(xmlforest.getChild(4) instanceof ASTID); + Assert.assertEquals("e.salary", xmlforest.getChild(5).getImage()); + Assert.assertEquals(6, xmlforest.getNumChildren()); } }