Message msg = MessageFactory.getInstance().getMessage(
MessageType.JBOSS_XML);
assertEquals((msg != null), true);
Attachment at = msg.getAttachment();
assertEquals((msg != null), true);
at.addItem(new ExampleObject(0)); // un-named
at.addItemAt(0, new ExampleObject(0)); // un-named;
try
{
at.addItem(new Object());
fail();
}
catch (IllegalArgumentException ex)
{
}
assertEquals(at.getUnnamedCount(), 2);
assertEquals(at.get("foo"), null);
at.put("foobar", new ExampleObject(1));
assertEquals(at.getNamedCount(), 1);
at.addItem(new ExampleObject(1));
at.addItem(new ExampleObject(2));
assertEquals((at.getNames() != null), true);
assertEquals((at.removeItemAt(0) != null), true);
at.replaceItemAt(0, new ExampleObject(2));
int count = at.getUnnamedCount();
final String documentAsString = (String)Util.serialize(msg) ;
log.debug("Message looks like: " + documentAsString);
final Message nImpl = Util.deserialize(documentAsString) ;