public TestAddAttributeWithoutExistingNamespaceDeclaration(OMMetaFactory metaFactory) {
super(metaFactory);
}
protected void runTest() throws Throwable {
OMFactory factory = metaFactory.getOMFactory();
OMElement element = factory.createOMElement(new QName("test"));
OMNamespace ns = factory.createOMNamespace("urn:ns", "p");
OMAttribute att = factory.createOMAttribute("test", ns, "test");
element.addAttribute(att);
assertEquals(ns, element.findNamespace(ns.getNamespaceURI(), ns.getPrefix()));
Iterator it = element.getAllDeclaredNamespaces();
assertTrue(it.hasNext());
assertEquals(ns, it.next());