示例#1
0
 public void testTransform() throws Exception {
   transformer.setReturnClass(String.class);
   transformer.setMuleContext(muleContext);
   TestBean bean = new TestBean("json", 23, 2.2, "function(i){ return i; }");
   String trasfRes = (String) transformer.transform(bean);
   assertEquals(JSON_RESULT, trasfRes);
 }
 @Override
 public Transformer getTransformer() throws Exception {
   ObjectToJson trans = new ObjectToJson();
   trans.getSerializationMixins().put(FruitCollection.class, FruitCollectionMixin.class);
   trans.getSerializationMixins().put(Apple.class, AppleMixin.class);
   trans.getSerializationMixins().put(Orange.class, OrangeMixin.class);
   trans.setSourceClass(FruitCollection.class);
   initialiseObject(trans);
   return trans;
 }