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.beans.PropertyEditor;
13  import java.beans.PropertyEditorManager;
14  
15  public class PropertyEditorValueToTextTransformerTestCase extends AbstractTransformerTestCase
16  {
17      @Override
18      public Object getResultData()
19      {
20          return "True";
21      }
22  
23      @Override
24      public Transformer getRoundTripTransformer() throws Exception
25      {
26          return new PropertyEditorTextToValueTransformer(createBooleanPropertyEditor(), Boolean.class);
27      }
28  
29      @Override
30      public Object getTestData()
31      {
32          return new Boolean(true);
33      }
34  
35      @Override
36      public Transformer getTransformer() throws Exception
37      {
38          return new PropertyEditorValueToTextTransformer(createBooleanPropertyEditor(), Boolean.class);
39      }
40  
41      private PropertyEditor createBooleanPropertyEditor() throws Exception
42      {
43          return PropertyEditorManager.findEditor(boolean.class);
44      }
45  }