Methods Summary |
---|
protected void | setUp()
super.setUp();
try {
factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
.getConfiguration2());
builder = factory.getBuilder();
} catch (Exception e) {
fail("Unexpected exception" + e.getMessage());
}
|
protected void | tearDown()
factory = null;
builder = null;
super.tearDown();
|
public void | testSetNamedItemNS1()Runs the test case.
Document doc;
NodeList elementList;
Node anotherElement;
NamedNodeMap anotherMap;
Node arg;
Node testAddress;
NamedNodeMap map;
doc = (Document) load("staffNS", builder);
elementList = doc.getElementsByTagName("address");
anotherElement = elementList.item(2);
anotherMap = anotherElement.getAttributes();
arg = anotherMap.getNamedItemNS("http://www.netzero.com", "domestic");
testAddress = elementList.item(0);
map = testAddress.getAttributes();
{
boolean success = false;
try {
map.setNamedItemNS(arg);
} catch (DOMException ex) {
success = (ex.code == DOMException.INUSE_ATTRIBUTE_ERR);
}
assertTrue("throw_INUSE_ATTRIBUTE_ERR", success);
}
|
public void | testSetNamedItemNS2()
String namespaceURI = "http://www.usa.com";
String qualifiedName = "dmstc:domestic";
Document doc;
Document anotherDoc;
Node arg;
NodeList elementList;
Node testAddress;
NamedNodeMap attributes;
doc = (Document) load("staffNS", builder);
anotherDoc = (Document) load("staffNS", builder);
arg = anotherDoc.createAttributeNS(namespaceURI, qualifiedName);
arg.setNodeValue("Maybe");
elementList = doc.getElementsByTagName("address");
testAddress = elementList.item(0);
attributes = testAddress.getAttributes();
{
boolean success = false;
try {
attributes.setNamedItemNS(arg);
} catch (DOMException ex) {
success = (ex.code == DOMException.WRONG_DOCUMENT_ERR);
}
assertTrue("throw_WRONG_DOCUMENT_ERR", success);
}
|
public void | testSetNamedItemNS3()
String namespaceURI = "http://www.nist.gov";
String qualifiedName = "prefix:newAttr";
Document doc;
Node arg;
NodeList elementList;
Node testAddress;
NamedNodeMap attributes;
Node retnode;
String value;
doc = (Document) load("staffNS", builder);
arg = doc.createAttributeNS(namespaceURI, qualifiedName);
arg.setNodeValue("newValue");
elementList = doc.getElementsByTagName("address");
testAddress = elementList.item(0);
attributes = testAddress.getAttributes();
attributes.setNamedItemNS(arg);
retnode = attributes.getNamedItemNS(namespaceURI, "newAttr");
value = retnode.getNodeValue();
assertEquals("throw_Equals", "newValue", value);
|
public void | testSetNamedItemNS5()
String namespaceURI = "http://www.usa.com";
String qualifiedName = "dmstc:domestic";
Document doc;
Node arg;
NodeList elementList;
Node testAddress;
NamedNodeMap attributes;
Node retnode;
String value;
doc = (Document) load("staffNS", builder);
arg = doc.createAttributeNS(namespaceURI, qualifiedName);
arg.setNodeValue("newValue");
elementList = doc.getElementsByTagName("address");
testAddress = elementList.item(0);
attributes = testAddress.getAttributes();
retnode = attributes.setNamedItemNS(arg);
value = retnode.getNodeValue();
assertEquals("throw_Equals", "Yes", value);
|