Encoder encoder = jaxbModule.encoder(new JAXBEncoder(jaxbContextFactory));
MockObject mock = new MockObject();
mock.setValue("Test");
RequestTemplate template = new RequestTemplate();
encoder.encode(mock, template);
String NEWLINE = System.getProperty("line.separator");
StringBuilder expectedXml = new StringBuilder();
expectedXml.append("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>").append(NEWLINE)
.append("<mockObject>").append(NEWLINE)
.append(" <value>Test</value>").append(NEWLINE)
.append("</mockObject>").append(NEWLINE);
assertEquals(new String(template.body(), UTF_8), expectedXml.toString());
}