protected void doTestSimpleRoundtrip(final Marshaller marshaller)
throws IOException
{
// simple roundtrip
final Attributes attributes1 = new DefaultAttributes();
attributes1.put("foo", "fooVal");
attributes1.put("bar", "barVal");
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
marshaller.marshal(attributes1, bos);
final ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
final Attributes attributes2 = marshaller.unmarshal(bis);
// size same
assertThat(attributes2.asMap().size(), equalTo(attributes1.asMap().size()));
// as maps are equal
assertThat(attributes2.asMap(), equalTo(attributes1.asMap()));
// but we deal with two different instances
assertThat(System.identityHashCode(attributes2), not(equalTo(System.identityHashCode(attributes1))));
}