View Javadoc

1   /*
2    * $Id: SingletonObjectFactoryTestCase.java 19191 2010-08-25 21:05:23Z tcarlson $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.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  public class SingletonObjectFactoryTestCase extends AbstractObjectFactoryTestCase
14  {
15  
16      @Override
17      public AbstractObjectFactory getUninitialisedObjectFactory()
18      {
19          return new SingletonObjectFactory();
20      }
21  
22      @Override
23      public void testGetObjectClass() throws Exception
24      {
25          SingletonObjectFactory factory = (SingletonObjectFactory) getUninitialisedObjectFactory();
26          factory.setObjectClass(Object.class);
27          factory.initialise();
28          
29          assertEquals(Object.class, factory.getObjectClass());
30      }
31  
32      @Override
33      public void testGet() throws Exception
34      {
35          SingletonObjectFactory factory = (SingletonObjectFactory) getUninitialisedObjectFactory();
36          factory.setObjectClass(Object.class);
37          factory.initialise();
38          
39          assertSame(factory.getInstance(muleContext), factory.getInstance(muleContext));
40      }
41  
42  }