View Javadoc

1   /*
2    * $Id: PrototypeObjectFactoryTestCase.java 20321 2010-11-24 15:21:24Z dfeist $
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 PrototypeObjectFactoryTestCase extends AbstractObjectFactoryTestCase
14  {
15  
16      @Override
17      public AbstractObjectFactory getUninitialisedObjectFactory()
18      {
19          return new PrototypeObjectFactory();
20      }
21  
22      @Override
23      public void testGetObjectClass() throws Exception
24      {
25          PrototypeObjectFactory factory = (PrototypeObjectFactory) getUninitialisedObjectFactory();
26          factory.setObjectClass(Object.class);
27          muleContext.getRegistry().applyProcessorsAndLifecycle(factory);
28          
29          assertEquals(Object.class, factory.getObjectClass());
30      }
31  
32      @Override
33      public void testGet() throws Exception
34      {
35          PrototypeObjectFactory factory = (PrototypeObjectFactory) getUninitialisedObjectFactory();
36          factory.setObjectClass(Object.class);
37          muleContext.getRegistry().applyProcessorsAndLifecycle(factory);
38          
39          assertNotSame(factory.getInstance(muleContext), factory.getInstance(muleContext));
40      }
41  
42  }