protected void runTest() throws Throwable {
Document document = dbf.newDocumentBuilder().newDocument();
Element documentElement = document.createElementNS("urn:test", "ns:root");
documentElement.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "xmlns:ns", "urn:test");
document.appendChild(documentElement);
assertEquals("urn:test", document.lookupNamespaceURI("ns"));
// The following assertion is important to check that there is no infinite recursion
// (Document delegates the lookup to its document element, but the document element must
// not delegate to its parent if no matching declaration is found)
assertNull(document.lookupNamespaceURI("p"));
}