Browse Source

Merge branch '6.2.x'

pull/34429/head
Sam Brannen 10 months ago
parent
commit
9eae0b6f6f
  1. 8
      framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-mockitobean.adoc
  2. 5
      framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-testbean.adoc

8
framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-mockitobean.adoc

@ -1,9 +1,11 @@
[[spring-testing-annotation-beanoverriding-mockitobean]] [[spring-testing-annotation-beanoverriding-mockitobean]]
= `@MockitoBean` and `@MockitoSpyBean` = `@MockitoBean` and `@MockitoSpyBean`
`@MockitoBean` and `@MockitoSpyBean` can be used in test classes to override a bean in {spring-framework-api}/test/context/bean/override/mockito/MockitoBean.html[`@MockitoBean`] and
the test's `ApplicationContext` with a Mockito _mock_ or _spy_, respectively. In the {spring-framework-api}/test/context/bean/override/mockito/MockitoSpyBean.html[`@MockitoSpyBean`]
latter case, an early instance of the original bean is captured and wrapped by the spy. can be used in test classes to override a bean in the test's `ApplicationContext` with a
Mockito _mock_ or _spy_, respectively. In the latter case, an early instance of the
original bean is captured and wrapped by the spy.
The annotations can be applied in the following ways. The annotations can be applied in the following ways.

5
framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-testbean.adoc

@ -1,8 +1,9 @@
[[spring-testing-annotation-beanoverriding-testbean]] [[spring-testing-annotation-beanoverriding-testbean]]
= `@TestBean` = `@TestBean`
`@TestBean` is used on a non-static field in a test class to override a specific bean in {spring-framework-api}/test/context/bean/override/convention/TestBean.html[`@TestBean`]
the test's `ApplicationContext` with an instance provided by a factory method. is used on a non-static field in a test class to override a specific bean in the test's
`ApplicationContext` with an instance provided by a factory method.
The associated factory method name is derived from the annotated field's name, or the The associated factory method name is derived from the annotated field's name, or the
bean name if specified. The factory method must be `static`, accept no arguments, and bean name if specified. The factory method must be `static`, accept no arguments, and

Loading…
Cancel
Save