info.joseluismartin.mock
Class MockReplacer

java.lang.Object
  extended by info.joseluismartin.mock.MockReplacer
All Implemented Interfaces:
org.springframework.beans.factory.config.BeanFactoryPostProcessor

public class MockReplacer
extends Object
implements org.springframework.beans.factory.config.BeanFactoryPostProcessor

Replace singletons in configurableListableBeanFactory with mocks

Author:
Jose Luis Martin - (jlm@joseluismartin.info)

Constructor Summary
MockReplacer()
           
 
Method Summary
 void add(String name, Object obj)
          Add a replaced mock
 Map<String,Object> getReplacedBeans()
          get the map with replaced beans
 void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory factory)
          implements BeanFactoryPostProcessor.postProcessBeanFactory(ConfigurableListableBeanFactory)
 void setReplacedBeans(Map<String,Object> replacedBeans)
          Set the replacedBeans Map
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockReplacer

public MockReplacer()
Method Detail

postProcessBeanFactory

public void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory factory)
                            throws org.springframework.beans.BeansException
implements BeanFactoryPostProcessor.postProcessBeanFactory(ConfigurableListableBeanFactory)

Specified by:
postProcessBeanFactory in interface org.springframework.beans.factory.config.BeanFactoryPostProcessor
Parameters:
factory - the BeanFactory to postprocess
Throws:
org.springframework.beans.BeansException - if fail

add

public final void add(String name,
                      Object obj)
Add a replaced mock

Parameters:
name - name of singleton
obj - mock

getReplacedBeans

public Map<String,Object> getReplacedBeans()
get the map with replaced beans

Returns:
replacedBeans

setReplacedBeans

public void setReplacedBeans(Map<String,Object> replacedBeans)
Set the replacedBeans Map

Parameters:
replacedBeans - Map with replaced beans


Copyright © 2012 JDAL. All Rights Reserved.