use of net.sf.saxon.tree.iter.EmptyIterator in project checkstyle by checkstyle.
the class ElementNodeTest method testIterateAxisEmptyChildren.
@Test
public void testIterateAxisEmptyChildren() {
final DetailAstImpl detailAST = new DetailAstImpl();
detailAST.setType(TokenTypes.METHOD_DEF);
final ElementNode elementNode = new ElementNode(rootNode, rootNode, detailAST, 1, 0);
try (AxisIterator iterator = elementNode.iterateAxis(AxisInfo.CHILD)) {
assertWithMessage("Invalid iterator").that(iterator instanceof EmptyIterator).isTrue();
}
try (AxisIterator iterator = elementNode.iterateAxis(AxisInfo.DESCENDANT)) {
assertWithMessage("Invalid iterator").that(iterator instanceof EmptyIterator).isTrue();
}
}
use of net.sf.saxon.tree.iter.EmptyIterator in project checkstyle by checkstyle.
the class ElementNodeTest method testIterateAxisWithNoSiblings.
@Test
public void testIterateAxisWithNoSiblings() {
final DetailAstImpl detailAST = new DetailAstImpl();
detailAST.setType(TokenTypes.VARIABLE_DEF);
final DetailAstImpl parentAST = new DetailAstImpl();
parentAST.setFirstChild(detailAST);
parentAST.setType(TokenTypes.METHOD_DEF);
final AbstractNode parentNode = new ElementNode(rootNode, rootNode, parentAST, 1, 0);
final AbstractNode elementNode = parentNode.getChildren().get(0);
try (AxisIterator iterator = elementNode.iterateAxis(AxisInfo.FOLLOWING_SIBLING)) {
assertWithMessage("Invalid iterator").that(iterator instanceof EmptyIterator).isTrue();
}
try (AxisIterator iterator = elementNode.iterateAxis(AxisInfo.PRECEDING_SIBLING)) {
assertWithMessage("Invalid iterator").that(iterator instanceof EmptyIterator).isTrue();
}
}
Aggregations