public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAdapter implements BeanClassLoaderAware, BeanFactoryAware, BeanFactoryPostProcessor, Ordered
BeanFactoryPostProcessor used to register and inject
@MockBeans with the ApplicationContext. An initial set of
definitions can be passed to the processor with additional definitions being
automatically created from @Configuration classes that use
@MockBean.HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE| Constructor and Description |
|---|
MockitoPostProcessor(Set<org.springframework.boot.test.mock.mockito.Definition> definitions)
Create a new
MockitoPostProcessor instance with the given initial
definitions. |
determineCandidateConstructors, getEarlyBeanReference, postProcessAfterInitialization, postProcessAfterInstantiation, postProcessBeforeInitialization, postProcessBeforeInstantiation, predictBeanTypepublic MockitoPostProcessor(Set<org.springframework.boot.test.mock.mockito.Definition> definitions)
MockitoPostProcessor instance with the given initial
definitions.definitions - the initial definitionspublic void setBeanClassLoader(ClassLoader classLoader)
setBeanClassLoader in interface BeanClassLoaderAwarepublic void setBeanFactory(BeanFactory beanFactory) throws BeansException
setBeanFactory in interface BeanFactoryAwareBeansExceptionpublic void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException
postProcessBeanFactory in interface BeanFactoryPostProcessorBeansExceptionprotected final Object createMock(org.springframework.boot.test.mock.mockito.MockDefinition mockDefinition, String name)
mockDefinition - the mock definitionname - the bean nameprotected Object createSpyIfNecessary(Object bean, String beanName) throws BeansException
BeansExceptionpublic PropertyValues postProcessPropertyValues(PropertyValues pvs, PropertyDescriptor[] pds, Object bean, String beanName) throws BeansException
postProcessPropertyValues in interface InstantiationAwareBeanPostProcessorpostProcessPropertyValues in class InstantiationAwareBeanPostProcessorAdapterBeansExceptionpublic static void register(BeanDefinitionRegistry registry)
BeanDefinitionRegistry. Not required when
using the SpringRunner as registration is automatic.registry - the bean definition registrypublic static void register(BeanDefinitionRegistry registry, Set<org.springframework.boot.test.mock.mockito.Definition> definitions)
BeanDefinitionRegistry. Not required when
using the SpringRunner as registration is automatic.registry - the bean definition registrydefinitions - the initial mock/spy definitionspublic static void register(BeanDefinitionRegistry registry, Class<? extends MockitoPostProcessor> postProcessor, Set<org.springframework.boot.test.mock.mockito.Definition> definitions)
BeanDefinitionRegistry. Not required when
using the SpringRunner as registration is automatic.registry - the bean definition registrypostProcessor - the post processor class to registerdefinitions - the initial mock/spy definitionsCopyright © 2018 Pivotal Software, Inc.. All rights reserved.