org.jasig.springframework.mockito
Class MockitoFactoryBean<T>

java.lang.Object
  extended by org.springframework.beans.factory.config.AbstractFactoryBean<T>
      extended by org.jasig.springframework.mockito.MockitoFactoryBean<T>
Type Parameters:
T - Type of the mock instance to return
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.FactoryBean<T>, org.springframework.beans.factory.InitializingBean

public class MockitoFactoryBean<T>
extends org.springframework.beans.factory.config.AbstractFactoryBean<T>

Used to create a spring bean via Mockito

Author:
Eric Dalquist

Field Summary
 
Fields inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
logger
 
Constructor Summary
MockitoFactoryBean(Class<? extends T> type)
           
 
Method Summary
protected  T createInstance()
           
protected  void destroyInstance(T instance)
           
 Class<? extends T> getObjectType()
           
static void resetAllMocks()
          Reset all mocks that have been created with this factory, usually called from the @Before method in a junit test case to reset mocks before each test
 
Methods inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
afterPropertiesSet, destroy, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockitoFactoryBean

public MockitoFactoryBean(Class<? extends T> type)
Method Detail

resetAllMocks

public static void resetAllMocks()
Reset all mocks that have been created with this factory, usually called from the @Before method in a junit test case to reset mocks before each test


getObjectType

public Class<? extends T> getObjectType()
Specified by:
getObjectType in interface org.springframework.beans.factory.FactoryBean<T>
Specified by:
getObjectType in class org.springframework.beans.factory.config.AbstractFactoryBean<T>

createInstance

protected T createInstance()
                    throws Exception
Specified by:
createInstance in class org.springframework.beans.factory.config.AbstractFactoryBean<T>
Throws:
Exception

destroyInstance

protected void destroyInstance(T instance)
                        throws Exception
Overrides:
destroyInstance in class org.springframework.beans.factory.config.AbstractFactoryBean<T>
Throws:
Exception


Copyright © 2013 Jasig. All Rights Reserved.