Event implements Serializable, ValueObject { @Override public String toString() { return new ToStringBuilder(this).append("id", id).append("data", data) .append("meta", meta).toString(); } protected  Event();  Event(@NotNull final EventId id, @NotNull final Data data);  Event(@NotNull final EventId id, @NotNull final Data data,
            @Nullable final Data meta); @NotNull final EventId getId(); @NotNull final Data getData(); @Nullable final Data getMeta(); final CommonEvent asCommonEvent(final JAXBContext ctx); @Override final int hashCode(); @Override final boolean equals(Object obj); @Override String toString(); static Event valueOf(final CommonEvent selEvent);  }
@Test public final void testMarshalUnmarshalXML() throws Exception { final Event original = testee; final String xml = marshalToStr(original, createXmlAdapter(), Event.class); final String expectedXml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" + "<event id=\"" + ID.asBaseType() + "\">" + " <data type=\"MyEvent\" mime-type=\"application/xml; version=1; encoding=utf-8\">" + " <![CDATA[<myEvent/>]]>" + " </data>" + " <meta type=\"MyMeta\" mime-type=\"application/json; encoding=utf-8\">" + " <![CDATA[{ \"a\" : \"1\" }]]>" + " </meta>" + "</event>"; final Diff documentDiff = DiffBuilder.compare(expectedXml).withTest(xml).ignoreWhitespace().build(); assertThat(documentDiff.hasDifferences()).describedAs(documentDiff.toString()).isFalse(); }