Binary { public boolean isCompressed() { if (isCompressed == null) { return false; } return isCompressed; } Binary();  Binary(BinaryContract binaryContract); int getId(); boolean isCompressed(); byte[] getData(); @Override final int hashCode(); @Override final boolean equals(Object obj);  }
@Test public void shouldMarshallObjectToXml() throws Exception { Binary binary = new BinaryBuilder() .id(5) .data(new byte[10]) .isCompressed(true) .build(); ByteArrayOutputStream bos = new SimpleXmlParser().toXml(binary); String xml = XmlStringCleaner.cleanXmlString(new String(bos.toByteArray())); Assert.assertEquals("<Binary ID='5' Compressed='True'>H4sIAAAAAAAAAGNggAEAdmiK4woAAAA=</Binary>", xml); }