use of org.apache.axiom.om.OMException in project webservices-axiom by apache.
the class TestDeclareDefaultNamespaceConflict1 method runTest.
@Override
protected void runTest() throws Throwable {
OMFactory factory = metaFactory.getOMFactory();
OMElement element = factory.createOMElement("test", null);
try {
element.declareDefaultNamespace("urn:test");
fail("Expected OMException");
} catch (OMException ex) {
// Expected
}
}
use of org.apache.axiom.om.OMException in project webservices-axiom by apache.
the class TestGetReaderException method runTest.
@Override
protected void runTest() throws Throwable {
OMFactory factory = metaFactory.getOMFactory();
OMSourcedElement element = factory.createOMElement(new AbstractPullOMDataSource() {
@Override
public XMLStreamReader getReader() throws XMLStreamException {
throw new XMLStreamException("Test exception");
}
@Override
public boolean isDestructiveRead() {
return true;
}
});
try {
element.getLocalName();
fail("Expected OMException");
} catch (OMException ex) {
Throwable cause = ex.getCause();
assertTrue(cause instanceof XMLStreamException);
assertEquals("Test exception", cause.getMessage());
}
}
use of org.apache.axiom.om.OMException in project webservices-axiom by apache.
the class TestInsertSiblingAfterOnChild method runTest.
@Override
protected void runTest() throws Throwable {
OMFactory factory = metaFactory.getOMFactory();
OMElement element = factory.createOMElement("test", null);
OMText text = factory.createOMText("test");
element.addChild(text);
try {
text.insertSiblingAfter(element);
fail("Expected OMException");
} catch (OMException ex) {
// Expected
}
}
use of org.apache.axiom.om.OMException in project webservices-axiom by apache.
the class TestInsertSiblingAfterOnOrphan method runTest.
@Override
protected void runTest() throws Throwable {
OMFactory fac = metaFactory.getOMFactory();
OMText text1 = fac.createOMText("text1");
OMText text2 = fac.createOMText("text2");
try {
text1.insertSiblingBefore(text2);
fail("Expected OMException because node has no parent");
} catch (OMException ex) {
// Expected
}
}
use of org.apache.axiom.om.OMException in project webservices-axiom by apache.
the class TestInsertSiblingBeforeOnChild method runTest.
@Override
protected void runTest() throws Throwable {
OMFactory factory = metaFactory.getOMFactory();
OMElement element = factory.createOMElement("test", null);
OMText text = factory.createOMText("test");
element.addChild(text);
try {
text.insertSiblingBefore(element);
fail("Expected OMException");
} catch (OMException ex) {
// Expected
}
}
Aggregations