ConfigTree config = new ConfigTree("config");
ObjectToXStream objectToXStream = new ObjectToXStream(config);
Message oMsg = MessageFactory.getInstance().getMessage();
oMsg.getBody().add(new TestBean("Tom", "1234"));
oMsg = objectToXStream.process(oMsg);
String xml = (String)oMsg.getBody().get();
XStream xstream = new XStream(new DomDriver());
TestBean bean = new TestBean();
assertTrue("Expected [<TestBean>]. Got [" + xml + "]", xml.startsWith("<TestBean>"));
xstream.alias("TestBean", TestBean.class);
xstream.fromXML(xml, bean);
assertEquals("Tom", bean.getName());
assertEquals("1234", bean.getPhone());
}