### Question:
PayloadConverter implements Converter { @Override public void marshal(Object o, HierarchicalStreamWriter writer, MarshallingContext mc) { Payload payload = (Payload) o; writer.startNode("payload"); Iterator<Statement> it = payload.iterator(); while (it.hasNext()) { MarshalUtil.writeNode(writer, it.next()); } writer.endNode(); }  @Override void marshal(Object o, HierarchicalStreamWriter writer, MarshallingContext mc); @Override Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext uc); @Override boolean canConvert(Class clazz);  }### Answer:
@Test public void testMarshal() { System.out.println("Testing Payload to XML"); Payload payload = new Payload(); payload.addStatement("protocol", "SNT084Eth8R8I"); payload.addStatement("SET", "behaviorValue", "EQUALS", "@event.isOn"); String marshal = xstream.toXML(payload); marshal = marshal.replace("\n", ""); marshal = marshal.replace(" ", ""); assertEquals(marshal, xml); }