From de2c10abcd47a3f13b8c93326e5f959f0e454fe8 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Mon, 28 Oct 2024 12:58:33 +0100 Subject: [PATCH] =?UTF-8?q?Sync=20Javadoc=20for=20@=E2=81=A0TestBean=20&?= =?UTF-8?q?=20@=E2=81=A0MockitoBean=20with=20reference=20manual?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See gh-33701 --- .../bean/override/convention/TestBean.java | 17 ++++++++--------- .../bean/override/mockito/MockitoBean.java | 17 ++++++++--------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/spring-test/src/main/java/org/springframework/test/context/bean/override/convention/TestBean.java b/spring-test/src/main/java/org/springframework/test/context/bean/override/convention/TestBean.java index 5c22a4b0c3..2b4a908280 100644 --- a/spring-test/src/main/java/org/springframework/test/context/bean/override/convention/TestBean.java +++ b/spring-test/src/main/java/org/springframework/test/context/bean/override/convention/TestBean.java @@ -38,10 +38,10 @@ import org.springframework.test.context.bean.override.BeanOverride; * Alternatively, you can explicitly specify a bean name to replace by setting the * {@link #value() value} or {@link #name() name} attribute. * - *
A new bean definition will be created if a corresponding bean definition does - * not exist. However, if you would like for the test to fail when a corresponding - * bean definition does not exist, you can set the {@link #enforceOverride() - * enforceOverride} attribute to {@code true}. + *
A bean will be created if a corresponding bean does not exist. However, if + * you would like for the test to fail when a corresponding bean does not exist, + * you can set the {@link #enforceOverride() enforceOverride} attribute to {@code true} + * — for example, {@code @TestBean(enforceOverride = true)}. * *
The instance is created from a zero-argument static factory method in the * test class whose return type is compatible with the annotated field. In the @@ -151,12 +151,11 @@ public @interface TestBean { String methodName() default ""; /** - * Whether to require the existence of a bean definition for the bean being - * overridden. - *
Defaults to {@code false} which means that a new bean definition will - * be created if a corresponding bean definition does not exist. + * Whether to require the existence of the bean being overridden. + *
Defaults to {@code false} which means that a bean will be created if a + * corresponding bean does not exist. *
Set to {@code true} to cause an exception to be thrown if a corresponding - * bean definition does not exist. + * bean does not exist. * @see org.springframework.test.context.bean.override.BeanOverrideStrategy#REPLACE_OR_CREATE * @see org.springframework.test.context.bean.override.BeanOverrideStrategy#REPLACE */ diff --git a/spring-test/src/main/java/org/springframework/test/context/bean/override/mockito/MockitoBean.java b/spring-test/src/main/java/org/springframework/test/context/bean/override/mockito/MockitoBean.java index 12dcf0a151..d664217c49 100644 --- a/spring-test/src/main/java/org/springframework/test/context/bean/override/mockito/MockitoBean.java +++ b/spring-test/src/main/java/org/springframework/test/context/bean/override/mockito/MockitoBean.java @@ -41,10 +41,10 @@ import org.springframework.test.context.bean.override.BeanOverride; * Alternatively, you can explicitly specify a bean name to mock by setting the * {@link #value() value} or {@link #name() name} attribute. * - *
A new bean definition will be created if a corresponding bean definition does - * not exist. However, if you would like for the test to fail when a corresponding - * bean definition does not exist, you can set the {@link #enforceOverride() - * enforceOverride} attribute to {@code true}. + *
A bean will be created if a corresponding bean does not exist. However, if + * you would like for the test to fail when a corresponding bean does not exist, + * you can set the {@link #enforceOverride() enforceOverride} attribute to {@code true} + * — for example, {@code @MockitoBean(enforceOverride = true)}. * *
Dependencies that are known to the application context but are not beans * (such as those @@ -121,12 +121,11 @@ public @interface MockitoBean { MockReset reset() default MockReset.AFTER; /** - * Whether to require the existence of a bean definition for the bean being - * overridden. - *
Defaults to {@code false} which means that a new bean definition will - * be created if a corresponding bean definition does not exist. + * Whether to require the existence of the bean being mocked. + *
Defaults to {@code false} which means that a mock will be created if a + * corresponding bean does not exist. *
Set to {@code true} to cause an exception to be thrown if a corresponding - * bean definition does not exist. + * bean does not exist. * @see org.springframework.test.context.bean.override.BeanOverrideStrategy#REPLACE_OR_CREATE * @see org.springframework.test.context.bean.override.BeanOverrideStrategy#REPLACE */