1   /*
2    * $Id: TransactionFactoryConverterTestCase.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.test.config;
12  
13  import org.mule.config.converters.TransactionFactoryConverter;
14  import org.mule.tck.testmodels.mule.TestTransactionFactory;
15  import org.mule.umo.UMOTransactionFactory;
16  
17  import org.apache.commons.beanutils.Converter;
18  
19  public class TransactionFactoryConverterTestCase extends AbstractConverterTestCase
20  {
21  
22      public Converter getConverter()
23      {
24          return new TransactionFactoryConverter();
25      }
26  
27      public Object getValidConvertedType()
28      {
29          return new TestTransactionFactory();
30      }
31  
32      public String getLookupMethod()
33      {
34          return null;
35      }
36  
37      public void testValidConversion()
38      {
39          Object obj = getConverter().convert(UMOTransactionFactory.class,
40              TestTransactionFactory.class.getName());
41          assertNotNull(obj);
42          assertTrue(obj instanceof TestTransactionFactory);
43      }
44  
45      public void testInvalidConversion()
46      {
47          try
48          {
49              getConverter().convert(UMOTransactionFactory.class, "foo.bar.bad.TransactionFactory");
50              fail("should throw exception on bad transaction factory class");
51          }
52          catch (Exception e)
53          {
54              // expected
55          }
56  
57      }
58  
59  }