use of org.apache.axiom.ts.om.document.jaxb.Order in project webservices-axiom by apache.
the class TestGetSAXResultJAXB method runTest.
@Override
protected void runTest() throws Throwable {
List<OrderItem> items = new ArrayList<OrderItem>(2);
OrderItem item = new OrderItem();
item.setPartId("P85-137-19");
item.setQuantity(2);
items.add(item);
item = new OrderItem();
item.setPartId("O85-554-66");
item.setQuantity(1);
items.add(item);
Order order = new Order();
order.setCustomerId("73107481");
order.setItems(items);
Marshaller marshaller = JAXBContext.newInstance(Order.class).createMarshaller();
StringWriter out = new StringWriter();
marshaller.marshal(order, out);
OMDocument document = metaFactory.getOMFactory().createOMDocument();
marshaller.marshal(order, document.getSAXResult().getHandler());
assertAbout(xml()).that(xml(OMDocument.class, document)).hasSameContentAs(out.toString());
}
Aggregations