Class MockitoPostProcessor
java.lang.Object
org.springframework.boot.test.mock.mockito.MockitoPostProcessor
- All Implemented Interfaces:
Aware
,BeanClassLoaderAware
,BeanFactoryAware
,BeanFactoryPostProcessor
,BeanPostProcessor
,InstantiationAwareBeanPostProcessor
,Ordered
@Deprecated(since="3.4.0")
public class MockitoPostProcessor
extends Object
implements InstantiationAwareBeanPostProcessor, BeanClassLoaderAware, BeanFactoryAware, BeanFactoryPostProcessor, Ordered
Deprecated.
A
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
.- Since:
- 1.4.0
- Author:
- Phillip Webb, Andy Wilkinson, Stephane Nicoll, Andreas Neiser
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorDescriptionMockitoPostProcessor
(Set<org.springframework.boot.test.mock.mockito.Definition> definitions) Deprecated.Create a newMockitoPostProcessor
instance with the given initial definitions. -
Method Summary
Modifier and TypeMethodDescriptionprotected final Object
createSpyIfNecessary
(Object bean, String beanName) Deprecated.int
getOrder()
Deprecated.void
postProcessBeanFactory
(ConfigurableListableBeanFactory beanFactory) Deprecated.postProcessProperties
(PropertyValues pvs, Object bean, String beanName) Deprecated.static void
register
(BeanDefinitionRegistry registry) Deprecated.Register the processor with aBeanDefinitionRegistry
.static void
register
(BeanDefinitionRegistry registry, Class<? extends MockitoPostProcessor> postProcessor, Set<org.springframework.boot.test.mock.mockito.Definition> definitions) Deprecated.Register the processor with aBeanDefinitionRegistry
.static void
register
(BeanDefinitionRegistry registry, Set<org.springframework.boot.test.mock.mockito.Definition> definitions) Deprecated.Register the processor with aBeanDefinitionRegistry
.void
setBeanClassLoader
(ClassLoader classLoader) Deprecated.void
setBeanFactory
(BeanFactory beanFactory) Deprecated.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.beans.factory.config.BeanPostProcessor
postProcessAfterInitialization, postProcessBeforeInitialization
Methods inherited from interface org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor
postProcessAfterInstantiation, postProcessBeforeInstantiation
-
Constructor Details
-
MockitoPostProcessor
Deprecated.Create a newMockitoPostProcessor
instance with the given initial definitions.- Parameters:
definitions
- the initial definitions
-
-
Method Details
-
setBeanClassLoader
Deprecated.- Specified by:
setBeanClassLoader
in interfaceBeanClassLoaderAware
-
setBeanFactory
Deprecated.- Specified by:
setBeanFactory
in interfaceBeanFactoryAware
- Throws:
BeansException
-
postProcessBeanFactory
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException Deprecated.- Specified by:
postProcessBeanFactory
in interfaceBeanFactoryPostProcessor
- Throws:
BeansException
-
createSpyIfNecessary
Deprecated.- Throws:
BeansException
-
postProcessProperties
public PropertyValues postProcessProperties(PropertyValues pvs, Object bean, String beanName) throws BeansException Deprecated.- Specified by:
postProcessProperties
in interfaceInstantiationAwareBeanPostProcessor
- Throws:
BeansException
-
getOrder
public int getOrder()Deprecated. -
register
Deprecated.Register the processor with aBeanDefinitionRegistry
. Not required when using theSpringRunner
as registration is automatic.- Parameters:
registry
- the bean definition registry
-
register
public static void register(BeanDefinitionRegistry registry, Set<org.springframework.boot.test.mock.mockito.Definition> definitions) Deprecated.Register the processor with aBeanDefinitionRegistry
. Not required when using theSpringRunner
as registration is automatic.- Parameters:
registry
- the bean definition registrydefinitions
- the initial mock/spy definitions
-
register
public static void register(BeanDefinitionRegistry registry, Class<? extends MockitoPostProcessor> postProcessor, Set<org.springframework.boot.test.mock.mockito.Definition> definitions) Deprecated.Register the processor with aBeanDefinitionRegistry
. Not required when using theSpringRunner
as registration is automatic.- Parameters:
registry
- the bean definition registrypostProcessor
- the post processor class to registerdefinitions
- the initial mock/spy definitions
-
MockitoBean
andMockitoSpyBean
support