View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.transformer.simple;
8   
9   import org.mule.api.transformer.Transformer;
10  import org.mule.transformer.AbstractTransformerTestCase;
11  
12  import java.util.Map;
13  import java.util.TreeMap;
14  
15  public class ObjectToStringWithMapTestCase extends AbstractTransformerTestCase
16  {
17  
18      public Transformer getTransformer() throws Exception
19      {
20          return new ObjectToString();
21      }
22  
23      public Object getTestData()
24      {
25          // TreeMap guarantees the order of keys. This is important for creating a test result
26          // that is guaranteed to be comparable to the output of getResultData.
27          Map map = new TreeMap();
28          map.put("existingValue", "VALUE");
29          map.put("nonexistingValue", null);
30          return map;
31      }
32  
33      public Object getResultData()
34      {
35          return "{existingValue=VALUE, nonexistingValue=null}";
36      }
37  
38      public Transformer getRoundTripTransformer() throws Exception
39      {
40          // we do not want round trip transforming tested
41          return null;
42      }
43  
44  }
45  
46