Annotation Type TestManagedMock
Named qualifier, the mock will be also registered under this specified
name.
If the test class declares several annotated fields having a common type among their ancestor,
then the type of the fields will be registered into the IoC container for that type and their
values could be get by using the
TestBeanContainer.getAllBeansByType(Class, Annotation...)
method. In that case, the call of
TestBeanContainer.getBeanByType(Class, Annotation...) method
with that type as parameter will throw an exception.
If the annotation is applied to a parameter, then a bean of the parameter type is first looking for in the IoC container used in the tests. If no such bean is found, then the type is mocked, the mock is then put into the bean container and finally it is passed as parameter value. By using this annotation with the parameters, you can get any previously mocked bean to, for example, specify behaviours for the current unit test.
- Author:
- mmoquillon
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanIs all of the methods of the mock should be stubbed?
-
Element Details
-
stubbed
boolean stubbedIs all of the methods of the mock should be stubbed? By default, a call to method of such an object is stubbed unless a behaviour was previously set to that method. To reverse this default behaviour, that is to say to allow a call to the methods invokes the real implementation of the called method, just set this property to false.- Default:
true
-