Annotation Interface MockitoBean
If no explicit name() is specified, a target bean definition is
 selected according to the class of the annotated field, and there must be
 exactly one such candidate definition in the context. A @Qualifier
 annotation can be used to help disambiguate.
 If a name() is specified, either the definition exists in the
 application context and is replaced, or it doesn't and a new one is added to
 the context.
 
Dependencies that are known to the application context but are not beans
 (such as those
 registered directly) will not be found, and a mocked bean will be added to
 the context alongside the existing dependency.
- Since:
- 6.2
- Author:
- Simon Baslé
- See Also:
- 
Optional Element SummaryOptional ElementsModifier and TypeOptional ElementDescriptionorg.mockito.AnswersTheAnswerstype to use on the mock.Class<?>[]Extra interfaces that should also be declared on the mock.The name of the bean to register or replace.The reset mode to apply to the mock.booleanWhether the generated mock is serializable.
- 
Element Details- 
nameString nameThe name of the bean to register or replace.If left unspecified, the bean to override is selected according to the annotated field's type. - Returns:
- the name of the mocked bean
 - Default:
- ""
 
- 
extraInterfacesClass<?>[] extraInterfacesExtra interfaces that should also be declared on the mock.Defaults to none. - Returns:
- any extra interfaces
- See Also:
- 
- MockSettings.extraInterfaces(Class...)
 
 - Default:
- {}
 
- 
answersorg.mockito.Answers answersTheAnswerstype to use on the mock.Defaults to Answers.RETURNS_DEFAULTS.- Returns:
- the answer type
 - Default:
- RETURNS_DEFAULTS
 
- 
serializableboolean serializableWhether the generated mock is serializable.Defaults to false.- Returns:
- trueif the mock is serializable
- See Also:
- 
- MockSettings.serializable()
 
 - Default:
- false
 
- 
resetMockReset resetThe reset mode to apply to the mock.The default is MockReset.AFTERmeaning that mocks are automatically reset after each test method is invoked.- Returns:
- the reset mode
 - Default:
- AFTER
 
 
-