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