File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
framework-docs/modules/ROOT/pages/testing/annotations/integration-spring Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 11[[spring-testing-annotation-beanoverriding-mockitobean]]
22= `@MockitoBean` and `@MockitoSpyBean`
33
4- `@MockitoBean` and `@MockitoSpyBean` can be used in test classes to override a bean in
5- the test's `ApplicationContext` with a Mockito _mock_ or _spy_, respectively. In the
6- latter case, an early instance of the original bean is captured and wrapped by the spy.
4+ {spring-framework-api}/test/context/bean/override/mockito/MockitoBean.html[`@MockitoBean`] and
5+ {spring-framework-api}/test/context/bean/override/mockito/MockitoSpyBean.html[`@MockitoSpyBean`]
6+ can be used in test classes to override a bean in the test's `ApplicationContext` with a
7+ Mockito _mock_ or _spy_, respectively. In the latter case, an early instance of the
8+ original bean is captured and wrapped by the spy.
79
810The annotations can be applied in the following ways.
911
Original file line number Diff line number Diff line change 11[[spring-testing-annotation-beanoverriding-testbean]]
22= `@TestBean`
33
4- `@TestBean` is used on a non-static field in a test class to override a specific bean in
5- the test's `ApplicationContext` with an instance provided by a factory method.
4+ {spring-framework-api}/test/context/bean/override/convention/TestBean.html[`@TestBean`]
5+ is used on a non-static field in a test class to override a specific bean in the test's
6+ `ApplicationContext` with an instance provided by a factory method.
67
78The associated factory method name is derived from the annotated field's name, or the
89bean name if specified. The factory method must be `static`, accept no arguments, and
You can’t perform that action at this time.
0 commit comments