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