1   /*
2    * $Id: Base64TransformersTestCase.java 11339 2008-03-12 23:13:20Z aperepel $
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.codec;
12  
13  import org.mule.api.transformer.Transformer;
14  import org.mule.transformer.AbstractTransformerTestCase;
15  import org.mule.util.Base64;
16  
17  public class Base64TransformersTestCase extends AbstractTransformerTestCase
18  {
19      private static final String TEST_DATA = "the quick brown fox jumped over the lazy dog";
20      
21      public Object getResultData()
22      {
23          try
24          {
25              return Base64.encodeBytes(TEST_DATA.getBytes());
26          }
27          catch (Exception ex)
28          {
29              fail();
30              return null;
31          }
32      }
33  
34      public Object getTestData()
35      {
36          return TEST_DATA;
37      }
38  
39      public Transformer getTransformer()
40      {
41          return new Base64Encoder();
42      }
43  
44      public Transformer getRoundTripTransformer()
45      {
46          Transformer t = new Base64Decoder();
47          // our input is a String so we expect a String as output
48          t.setReturnClass(String.class);
49          return t;
50      }
51      
52  }