import org.apache.camel.impl.MySerialBean;
public class DataFormatEndpointSerializationTest extends ContextTestSupport {
public void testSerialization() throws Exception {
MySerialBean bean = new MySerialBean();
bean.setId(123);
bean.setName("Donald");
Object data = template.requestBody("direct:marshal", bean);
assertNotNull(data);
Object out = template.requestBody("direct:unmarshal", data);
assertNotNull(out);
MySerialBean outBean = context.getTypeConverter().convertTo(MySerialBean.class, out);
assertNotNull(outBean);
assertEquals(123, outBean.getId());
assertEquals("Donald", outBean.getName());
}