Key { public void setData(String data) { this.data = data; }  String getData(); void setData(String data);  }
@Test public void shouldMarshallObjectToXml() throws Exception { Key key = new Key(); key.setData("someData"); ByteArrayOutputStream bos = new SimpleXmlParser().toXml(key); String xml = XmlStringCleaner.cleanXmlString(new String(bos.toByteArray())); Assert.assertEquals("<Key><Data>someData</Data></Key>", xml); }