* {@link XMLStreamWriter}.
*/
@Test
public void testSerializeDirect() throws Exception {
JAXBContext context = JAXBContext.newInstance(MyBean.class);
MyBean orgBean = new MyBean(3, 5);
JAXBOMDataSource ds = new JAXBOMDataSource(context, orgBean);
ByteArrayOutputStream out = new ByteArrayOutputStream();
XMLStreamWriter writer = StAXUtils.createXMLStreamWriter(out);
ds.serialize(writer);
writer.close();
MyBean bean = (MyBean)context.createUnmarshaller().unmarshal(
new ByteArrayInputStream(out.toByteArray()));
assertEquals(orgBean.getA(), bean.getA());
assertEquals(orgBean.getB(), bean.getB());
}