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