1   /*
2    * $Id: SingletonObjectFactoryTestCase.java 11376 2008-03-16 17:44:10Z 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.object;
12  
13  import org.mule.api.object.ObjectFactory;
14  import org.mule.object.SingletonObjectFactory;
15  
16  public class SingletonObjectFactoryTestCase extends AbstractObjectFactoryTestCase
17  {
18  
19      // @Override
20      public ObjectFactory getObjectFactory()
21      {
22          return new SingletonObjectFactory();
23      }
24  
25      // @Override
26      public void testGetObjectClass() throws Exception
27      {
28          SingletonObjectFactory factory = (SingletonObjectFactory) getObjectFactory();
29          factory.setObjectClass(Object.class);
30          factory.initialise();
31          assertEquals(Object.class, factory.getObjectClass());
32      }
33  
34      // @Override
35      public void testGet() throws Exception
36      {
37          SingletonObjectFactory factory = (SingletonObjectFactory) getObjectFactory();
38          factory.setObjectClass(Object.class);
39          factory.initialise();
40          assertSame(factory.getInstance(), factory.getInstance());
41      }
42  
43  }