use of org.apache.axiom.om.ds.AbstractPullOMDataSource 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());
}
}
Aggregations