DocumentBean object = new DocumentBean();
object.setId("test");
OMSourcedElement element = omFactory.createOMElement(new JAXBOMDataSource(context, object));
XMLStreamException exception = new XMLStreamException("TEST");
try {
element.serialize(new ExceptionXMLStreamWriterWrapper(StAXUtils.createXMLStreamWriter(new ByteArrayOutputStream()), exception));
fail("Expected XMLStreamException");
} catch (XMLStreamException ex) {
assertSame(exception, ex);
}
}