*
* @param p the node pointer to test
*/
private void checkIterators(NodePointer p)
{
ImmutableNode node = (ImmutableNode) p.getNode();
NodeIterator it = p.childIterator(null, false, null);
assertEquals("Iterator count differs from children count", node
.getChildren().size(), iteratorSize(it));
for (int index = 1; it.setPosition(index); index++)
{
NodePointer pchild = it.getNodePointer();
assertEquals("Wrong child", node.getChildren().get(index - 1),
pchild.getNode());
checkIterators(pchild);
}
it = p.attributeIterator(new QName(null, "*"));
assertEquals("Iterator count differs from attribute count", node
.getAttributes().size(), iteratorSize(it));
for (int index = 1; it.setPosition(index); index++)
{
NodePointer pattr = it.getNodePointer();
assertTrue("Node pointer is no attribute", pattr.isAttribute());
assertTrue("Wrong attribute name", node.getAttributes()
.containsKey(pattr.getName().getName()));
}
}