}
@Test
public void testWithXOP() throws Exception {
DataHandler dh = new DataHandler(new RandomDataSource(10000));
MemoryBlob blob = new MemoryBlob();
OutputStream out = blob.getOutputStream();
OMOutputFormat format = new OMOutputFormat();
format.setDoOptimize(true);
createTestDocument(dh).serialize(out, format);
out.close();
Attachments attachments = new Attachments(blob.getInputStream(), format.getContentType());
test(dh, new XOPAwareStAXOMBuilder(attachments.getRootPartInputStream(), attachments), false, true, true);
}