use of net.sourceforge.pmd.lang.ast.xpath.DocumentNavigator in project pmd by pmd.
the class DocumentNavigatorTest method testPrecedingSiblingAxisIterator.
@Test
public void testPrecedingSiblingAxisIterator() {
DocumentNavigator nav = new DocumentNavigator();
Iterator<Node> iter = nav.getPrecedingSiblingAxisIterator(rule.primaryExpression.jjtGetChild(1));
assertSame(rule.primaryExpression.jjtGetChild(0), iter.next());
assertFalse(iter.hasNext());
}
use of net.sourceforge.pmd.lang.ast.xpath.DocumentNavigator in project pmd by pmd.
the class DocumentNavigatorTest method testChildAxisIterator.
@Test
public void testChildAxisIterator() {
DocumentNavigator nav = new DocumentNavigator();
Iterator<Node> iter = nav.getChildAxisIterator(rule.compilationUnit);
assertSame(rule.compilationUnit.jjtGetChild(0), iter.next());
assertSame(rule.compilationUnit.jjtGetChild(1), iter.next());
assertFalse(iter.hasNext());
}
use of net.sourceforge.pmd.lang.ast.xpath.DocumentNavigator in project pmd by pmd.
the class DocumentNavigatorTest method testXPath.
@Test
public void testXPath() throws JaxenException {
BaseXPath xPath = new BaseXPath(".//*", new DocumentNavigator());
List<?> matches = xPath.selectNodes(rule.statement);
assertEquals(6, matches.size());
}
Aggregations