use of org.w3c.dom.DOMException in project webservices-axiom by apache.
the class TestSetAttributeNodeNSForeignImplementation method runTest.
@Override
protected void runTest() throws Throwable {
Document document = dbf.newDocumentBuilder().newDocument();
Element element = document.createElementNS(null, "test");
Attr attr = mock(Attr.class);
try {
element.setAttributeNodeNS(attr);
fail("Expected DOMException");
} catch (DOMException ex) {
assertThat(ex.code).isEqualTo(DOMException.WRONG_DOCUMENT_ERR);
}
}
use of org.w3c.dom.DOMException in project webservices-axiom by apache.
the class TestSetAttributeNodeNSWrongDocument method runTest.
protected void runTest() throws Throwable {
DocumentBuilder db = dbf.newDocumentBuilder();
Document document1 = db.newDocument();
Document document2 = db.newDocument();
Element element = document1.createElementNS(null, "test");
Attr attr = document2.createAttributeNS(null, "test");
try {
element.setAttributeNodeNS(attr);
fail("Expected DOMException");
} catch (DOMException ex) {
assertEquals(DOMException.WRONG_DOCUMENT_ERR, ex.code);
}
}
use of org.w3c.dom.DOMException in project webservices-axiom by apache.
the class TestSetPrefixNotNullWithoutNamespace method runTest.
protected void runTest() throws Throwable {
Document document = dbf.newDocumentBuilder().newDocument();
Element element = document.createElementNS(null, "test");
try {
element.setPrefix("p");
fail("Expected DOMException");
} catch (DOMException ex) {
assertEquals(DOMException.NAMESPACE_ERR, ex.code);
}
}
use of org.w3c.dom.DOMException in project webservices-axiom by apache.
the class TestSetNamedItemNSWrongDocument method runTest.
protected void runTest() throws Throwable {
DocumentBuilder db = dbf.newDocumentBuilder();
Document document1 = db.newDocument();
Document document2 = db.newDocument();
Element element = document1.createElementNS(null, "test");
Attr attr = document2.createAttributeNS(null, "test");
try {
element.getAttributes().setNamedItemNS(attr);
fail("Expected DOMException");
} catch (DOMException ex) {
assertEquals(DOMException.WRONG_DOCUMENT_ERR, ex.code);
}
}
use of org.w3c.dom.DOMException in project webservices-axiom by apache.
the class TestRemoveAttributeNodeForeignImplementation method runTest.
@Override
protected void runTest() throws Throwable {
Document document = dbf.newDocumentBuilder().newDocument();
Element element = document.createElementNS(null, "test");
Attr attr = mock(Attr.class);
try {
element.removeAttributeNode(attr);
fail("Expected DOMException");
} catch (DOMException ex) {
assertThat(ex.code).isEqualTo(DOMException.NOT_FOUND_ERR);
}
}
Aggregations