Class FakeBeanFactory
java.lang.Object
mockit.MockUp<org.springframework.beans.factory.support.DefaultListableBeanFactory>
mockit.integration.springframework.FakeBeanFactory
public final class FakeBeanFactory
extends MockUp<org.springframework.beans.factory.support.DefaultListableBeanFactory>
If applied, this fake will take over calls to
AbstractBeanFactory.getBean(String)
and
AbstractBeanFactory.getBean(String, Class)
in any implementation class, returning instead a
@Tested
or @Injectable
object with the given field name, or a dependency object
injected at any level into a @Tested
object.
In case said calls come (indirectly) from a test class having no @Tested
fields, bean lookup will
proceed into the actual getBean
implementation method.
Note this fake is only useful if the code under test makes direct calls to Spring's getBean
methods.
-
Field Summary
Fields inherited from class mockit.MockUp
targetType
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
getBean
(Invocation invocation, Class<T> requiredType) static Object
getBean
(Invocation invocation, String name) static <T> T
getBean
(Invocation invocation, String name, Class<T> requiredType) Methods inherited from class mockit.MockUp
getMockInstance, onTearDown
-
Constructor Details
-
FakeBeanFactory
public FakeBeanFactory()
-
-
Method Details
-
getBean
-
getBean
public static <T> T getBean(@NonNull Invocation invocation, @NonNull String name, @Nullable Class<T> requiredType) -
getBean
-