assertTrue("OMSourcedElement is expanded after build(). This is unexpected", !child.isExpanded());
parent.buildWithAttachments();
assertTrue("OMSourcedElement is expanded after buildWithAttachments(). This is unexpected", !child.isExpanded());
// Test getting the raw bytes from the ByteArrayDataSource.
OMDataSourceExt ds = (OMDataSourceExt) child.getDataSource();
byte[] bytes = ds.getXMLBytes("UTF-16"); // Get the bytes as UTF-16
String payload = new String(bytes, "utf-16");
assertTrue("The obtained bytes did not match the payload",
payload1.equals(payload));
// Test getting the raw bytes with the default encoding
OMOutputFormat outputFormat = new OMOutputFormat();
baos = new ByteArrayOutputStream();
ds.serialize(baos, outputFormat);
output = baos.toString(OMOutputFormat.DEFAULT_CHAR_SET_ENCODING);
// System.out.println(output);
assertTrue("The obtained bytes did not match the payload",
payload1.equals(output));
}