From ac0136b75c61e5b0b7b5b2e92fdcbe580aeff43d Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Tue, 7 May 2024 16:45:12 +0300 Subject: [PATCH] Clarify supported targets for annotations in the TestContext framework Closes gh-32772 --- .../integration-junit-jupiter.adoc | 10 +++++----- .../annotations/integration-junit4.adoc | 19 ++++++++++--------- .../annotation-activeprofiles.adoc | 4 ++-- .../annotation-bootstrapwith.adoc | 6 +++--- .../annotation-contextconfiguration.adoc | 8 ++++---- ...annotation-contextcustomizerfactories.adoc | 8 ++++---- .../annotation-contexthierarchy.adoc | 12 ++++++------ .../annotation-dirtiescontext.adoc | 6 +++--- .../annotation-disabledinaotmode.adoc | 2 +- .../annotation-dynamicpropertysource.adoc | 12 ++++++------ .../annotation-recordapplicationevents.adoc | 6 +++--- .../annotation-testexecutionlisteners.adoc | 2 +- .../annotation-testpropertysource.adoc | 4 ++-- .../annotation-webappconfiguration.adoc | 8 ++++---- .../test/annotation/DirtiesContext.java | 4 ++-- .../test/annotation/IfProfileValue.java | 6 +++--- .../ProfileValueSourceConfiguration.java | 6 +++--- .../test/context/ActiveProfiles.java | 10 +++++----- .../test/context/BootstrapWith.java | 7 ++++--- .../test/context/ContextConfiguration.java | 9 +++++---- .../context/ContextCustomizerFactories.java | 8 ++++---- .../test/context/ContextHierarchy.java | 6 +++--- .../test/context/DynamicPropertySource.java | 7 ++++--- .../test/context/NestedTestConfiguration.java | 8 ++++---- .../test/context/TestConstructor.java | 8 ++++---- .../test/context/TestExecutionListeners.java | 8 ++++---- .../test/context/TestPropertySource.java | 6 +++--- .../test/context/aot/DisabledInAotMode.java | 4 ++-- .../event/RecordApplicationEvents.java | 6 +++--- .../test/context/web/WebAppConfiguration.java | 8 ++++---- 30 files changed, 111 insertions(+), 107 deletions(-) diff --git a/framework-docs/modules/ROOT/pages/testing/annotations/integration-junit-jupiter.adoc b/framework-docs/modules/ROOT/pages/testing/annotations/integration-junit-jupiter.adoc index 4944779c3b4..64af8240b80 100644 --- a/framework-docs/modules/ROOT/pages/testing/annotations/integration-junit-jupiter.adoc +++ b/framework-docs/modules/ROOT/pages/testing/annotations/integration-junit-jupiter.adoc @@ -165,8 +165,8 @@ for further details. [[integration-testing-annotations-testconstructor]] == `@TestConstructor` -`@TestConstructor` is a type-level annotation that is used to configure how the parameters -of a test class constructor are autowired from components in the test's +`@TestConstructor` is an annotation that can be applied to a test class to configure how +the parameters of a test class constructor are autowired from components in the test's `ApplicationContext`. If `@TestConstructor` is not present or meta-present on a test class, the default _test @@ -199,9 +199,9 @@ Spring Boot Test. [[integration-testing-annotations-nestedtestconfiguration]] == `@NestedTestConfiguration` -`@NestedTestConfiguration` is a type-level annotation that is used to configure how -Spring test configuration annotations are processed within enclosing class hierarchies -for inner test classes. +`@NestedTestConfiguration` is an annotation that can be applied to a test class to +configure how Spring test configuration annotations are processed within enclosing class +hierarchies for inner test classes. If `@NestedTestConfiguration` is not present or meta-present on a test class, in its supertype hierarchy, or in its enclosing class hierarchy, the default _enclosing diff --git a/framework-docs/modules/ROOT/pages/testing/annotations/integration-junit4.adoc b/framework-docs/modules/ROOT/pages/testing/annotations/integration-junit4.adoc index 8c4c645d95a..3ac9413ff6d 100644 --- a/framework-docs/modules/ROOT/pages/testing/annotations/integration-junit4.adoc +++ b/framework-docs/modules/ROOT/pages/testing/annotations/integration-junit4.adoc @@ -13,10 +13,10 @@ xref:testing/testcontext-framework/support-classes.adoc#testcontext-junit4-runne [[integration-testing-annotations-junit4-ifprofilevalue]] == `@IfProfileValue` -`@IfProfileValue` indicates that the annotated test is enabled for a specific testing -environment. If the configured `ProfileValueSource` returns a matching `value` for the -provided `name`, the test is enabled. Otherwise, the test is disabled and, effectively, -ignored. +`@IfProfileValue` indicates that the annotated test class or test method is enabled for a +specific testing environment. If the configured `ProfileValueSource` returns a matching +`value` for the provided `name`, the test is enabled. Otherwise, the test is disabled +and, effectively, ignored. You can apply `@IfProfileValue` at the class level, the method level, or both. Class-level usage of `@IfProfileValue` takes precedence over method-level usage for any @@ -90,11 +90,12 @@ Kotlin:: [[integration-testing-annotations-junit4-profilevaluesourceconfiguration]] == `@ProfileValueSourceConfiguration` -`@ProfileValueSourceConfiguration` is a class-level annotation that specifies what type -of `ProfileValueSource` to use when retrieving profile values configured through the -`@IfProfileValue` annotation. If `@ProfileValueSourceConfiguration` is not declared for a -test, `SystemProfileValueSource` is used by default. The following example shows how to -use `@ProfileValueSourceConfiguration`: +`@ProfileValueSourceConfiguration` is an annotation that can be applied to a test class +to specify what type of `ProfileValueSource` to use when retrieving profile values +configured through the `@IfProfileValue` annotation. If +`@ProfileValueSourceConfiguration` is not declared for a test, `SystemProfileValueSource` +is used by default. The following example shows how to use +`@ProfileValueSourceConfiguration`: [tabs] ====== diff --git a/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-activeprofiles.adoc b/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-activeprofiles.adoc index 31299b96bd0..4d41be0bf68 100644 --- a/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-activeprofiles.adoc +++ b/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-activeprofiles.adoc @@ -1,8 +1,8 @@ [[spring-testing-annotation-activeprofiles]] = `@ActiveProfiles` -`@ActiveProfiles` is a class-level annotation that is used to declare which bean -definition profiles should be active when loading an `ApplicationContext` for an +`@ActiveProfiles` is an annotation that can be applied to a test class to declare which +bean definition profiles should be active when loading an `ApplicationContext` for an integration test. The following example indicates that the `dev` profile should be active: diff --git a/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-bootstrapwith.adoc b/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-bootstrapwith.adoc index 5769b3d3d3f..a297b014994 100644 --- a/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-bootstrapwith.adoc +++ b/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-bootstrapwith.adoc @@ -2,8 +2,8 @@ = `@BootstrapWith` :page-section-summary-toc: 1 -`@BootstrapWith` is a class-level annotation that you can use to configure how the Spring -TestContext Framework is bootstrapped. Specifically, you can use `@BootstrapWith` to -specify a custom `TestContextBootstrapper`. See the section on +`@BootstrapWith` is an annotation that can be applied to a test class to configure how +the Spring TestContext Framework is bootstrapped. Specifically, you can use +`@BootstrapWith` to specify a custom `TestContextBootstrapper`. See the section on xref:testing/testcontext-framework/bootstrapping.adoc[bootstrapping the TestContext framework] for further details. diff --git a/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-contextconfiguration.adoc b/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-contextconfiguration.adoc index 47294f5adae..55eb8169f0a 100644 --- a/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-contextconfiguration.adoc +++ b/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-contextconfiguration.adoc @@ -1,10 +1,10 @@ [[spring-testing-annotation-contextconfiguration]] = `@ContextConfiguration` -`@ContextConfiguration` defines class-level metadata that is used to determine how to -load and configure an `ApplicationContext` for integration tests. Specifically, -`@ContextConfiguration` declares the application context resource `locations` or the -component `classes` used to load the context. +`@ContextConfiguration` is an annotation that can be applied to a test class to configure +metadata that is used to determine how to load and configure an `ApplicationContext` for +integration tests. Specifically, `@ContextConfiguration` declares the application context +resource `locations` or the component `classes` used to load the context. Resource locations are typically XML configuration files or Groovy scripts located in the classpath, while component classes are typically `@Configuration` classes. However, diff --git a/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-contextcustomizerfactories.adoc b/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-contextcustomizerfactories.adoc index 0dc49e7bec5..3eb88e7ea0d 100644 --- a/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-contextcustomizerfactories.adoc +++ b/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-contextcustomizerfactories.adoc @@ -1,10 +1,10 @@ [[spring-testing-annotation-contextcustomizerfactories]] = `@ContextCustomizerFactories` -`@ContextCustomizerFactories` is used to register `ContextCustomizerFactory` -implementations for a particular test class, its subclasses, and its nested classes. If -you wish to register a factory globally, you should register it via the automatic -discovery mechanism described in +`@ContextCustomizerFactories` is an annotation that can be applied to a test class to +register `ContextCustomizerFactory` implementations for the particular test class, its +subclasses, and its nested classes. If you wish to register a factory globally, you +should register it via the automatic discovery mechanism described in xref:testing/testcontext-framework/ctx-management/context-customizers.adoc[`ContextCustomizerFactory` Configuration]. The following example shows how to register two `ContextCustomizerFactory` implementations: diff --git a/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-contexthierarchy.adoc b/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-contexthierarchy.adoc index 66aedbcb9fd..e1fd02d1168 100644 --- a/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-contexthierarchy.adoc +++ b/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-contexthierarchy.adoc @@ -1,12 +1,12 @@ [[spring-testing-annotation-contexthierarchy]] = `@ContextHierarchy` -`@ContextHierarchy` is a class-level annotation that is used to define a hierarchy of -`ApplicationContext` instances for integration tests. `@ContextHierarchy` should be -declared with a list of one or more `@ContextConfiguration` instances, each of which -defines a level in the context hierarchy. The following examples demonstrate the use of -`@ContextHierarchy` within a single test class (`@ContextHierarchy` can also be used -within a test class hierarchy): +`@ContextHierarchy` is an annotation that can be applied to a test class to define a +hierarchy of `ApplicationContext` instances for integration tests. `@ContextHierarchy` +should be declared with a list of one or more `@ContextConfiguration` instances, each of +which defines a level in the context hierarchy. The following examples demonstrate the +use of `@ContextHierarchy` within a single test class (`@ContextHierarchy` can also be +used within a test class hierarchy): [tabs] ====== diff --git a/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-dirtiescontext.adoc b/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-dirtiescontext.adoc index 12d361deca8..75d5856ad48 100644 --- a/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-dirtiescontext.adoc +++ b/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-dirtiescontext.adoc @@ -10,9 +10,9 @@ rebuilt for any subsequent test that requires a context with the same configurat metadata. You can use `@DirtiesContext` as both a class-level and a method-level annotation within -the same class or class hierarchy. In such scenarios, the `ApplicationContext` is marked -as dirty before or after any such annotated method as well as before or after the current -test class, depending on the configured `methodMode` and `classMode`. When +the same test class or test class hierarchy. In such scenarios, the `ApplicationContext` +is marked as dirty before or after any such annotated method as well as before or after +the current test class, depending on the configured `methodMode` and `classMode`. When `@DirtiesContext` is declared at both the class level and the method level, the configured modes from both annotations will be honored. For example, if the class mode is set to `BEFORE_EACH_TEST_METHOD` and the method mode is set to `AFTER_METHOD`, the diff --git a/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-disabledinaotmode.adoc b/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-disabledinaotmode.adoc index 2fbfc6a19b3..be7689d1b26 100644 --- a/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-disabledinaotmode.adoc +++ b/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-disabledinaotmode.adoc @@ -1,7 +1,7 @@ [[spring-testing-annotation-disabledinaotmode]] = `@DisabledInAotMode` -`@DisabledInAotMode` signals that an annotated test class is disabled in Spring AOT +`@DisabledInAotMode` signals that the annotated test class is disabled in Spring AOT (ahead-of-time) mode, which means that the `ApplicationContext` for the test class will not be processed for AOT optimizations at build time. diff --git a/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-dynamicpropertysource.adoc b/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-dynamicpropertysource.adoc index 4c6e37863c3..45457a62cd0 100644 --- a/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-dynamicpropertysource.adoc +++ b/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-dynamicpropertysource.adoc @@ -1,12 +1,12 @@ [[spring-testing-annotation-dynamicpropertysource]] = `@DynamicPropertySource` -`@DynamicPropertySource` is a method-level annotation that you can use to register -_dynamic_ properties to be added to the set of `PropertySources` in the `Environment` for -an `ApplicationContext` loaded for an integration test. Dynamic properties are useful -when you do not know the value of the properties upfront – for example, if the properties -are managed by an external resource such as for a container managed by the -{testcontainers-site}[Testcontainers] project. +`@DynamicPropertySource` is an annotation that can be applied to methods in integration +test classes that need to register _dynamic_ properties to be added to the set of +`PropertySources` in the `Environment` for an `ApplicationContext` loaded for an +integration test. Dynamic properties are useful when you do not know the value of the +properties upfront – for example, if the properties are managed by an external resource +such as for a container managed by the {testcontainers-site}[Testcontainers] project. The following example demonstrates how to register a dynamic property: diff --git a/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-recordapplicationevents.adoc b/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-recordapplicationevents.adoc index 73365f75e1b..15f41b4192b 100644 --- a/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-recordapplicationevents.adoc +++ b/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-recordapplicationevents.adoc @@ -2,9 +2,9 @@ = `@RecordApplicationEvents` :page-section-summary-toc: 1 -`@RecordApplicationEvents` is a class-level annotation that is used to instruct the -_Spring TestContext Framework_ to record all application events that are published in the -`ApplicationContext` during the execution of a single test. +`@RecordApplicationEvents` is an annotation that can be applied to a test class to +instruct the _Spring TestContext Framework_ to record all application events that are +published in the `ApplicationContext` during the execution of a single test. The recorded events can be accessed via the `ApplicationEvents` API within tests. diff --git a/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-testexecutionlisteners.adoc b/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-testexecutionlisteners.adoc index 370d1e7d586..2128f8b2c1e 100644 --- a/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-testexecutionlisteners.adoc +++ b/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-testexecutionlisteners.adoc @@ -1,7 +1,7 @@ [[spring-testing-annotation-testexecutionlisteners]] = `@TestExecutionListeners` -`@TestExecutionListeners` is used to register listeners for a particular test class, its +`@TestExecutionListeners` is used to register listeners for the annotated test class, its subclasses, and its nested classes. If you wish to register a listener globally, you should register it via the automatic discovery mechanism described in xref:testing/testcontext-framework/tel-config.adoc[`TestExecutionListener` Configuration]. diff --git a/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-testpropertysource.adoc b/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-testpropertysource.adoc index 157fc128902..e20851d78a2 100644 --- a/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-testpropertysource.adoc +++ b/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-testpropertysource.adoc @@ -1,8 +1,8 @@ [[spring-testing-annotation-testpropertysource]] = `@TestPropertySource` -`@TestPropertySource` is a class-level annotation that you can use to configure the -locations of properties files and inlined properties to be added to the set of +`@TestPropertySource` is an annotation that can be applied to a test class to configure +the locations of properties files and inlined properties to be added to the set of `PropertySources` in the `Environment` for an `ApplicationContext` loaded for an integration test. diff --git a/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-webappconfiguration.adoc b/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-webappconfiguration.adoc index 2c3d1ac328d..b48e537fe70 100644 --- a/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-webappconfiguration.adoc +++ b/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring/annotation-webappconfiguration.adoc @@ -1,10 +1,10 @@ [[spring-testing-annotation-webappconfiguration]] = `@WebAppConfiguration` -`@WebAppConfiguration` is a class-level annotation that you can use to declare that the -`ApplicationContext` loaded for an integration test should be a `WebApplicationContext`. -The mere presence of `@WebAppConfiguration` on a test class ensures that a -`WebApplicationContext` is loaded for the test, using the default value of +`@WebAppConfiguration` is an annotation that can be applied to a test class to declare +that the `ApplicationContext` loaded for an integration test should be a +`WebApplicationContext`. The mere presence of `@WebAppConfiguration` on a test class +ensures that a `WebApplicationContext` is loaded for the test, using the default value of `"file:src/main/webapp"` for the path to the root of the web application (that is, the resource base path). The resource base path is used behind the scenes to create a `MockServletContext`, which serves as the `ServletContext` for the test's diff --git a/spring-test/src/main/java/org/springframework/test/annotation/DirtiesContext.java b/spring-test/src/main/java/org/springframework/test/annotation/DirtiesContext.java index dff1ce6a26c..6e602f53380 100644 --- a/spring-test/src/main/java/org/springframework/test/annotation/DirtiesContext.java +++ b/spring-test/src/main/java/org/springframework/test/annotation/DirtiesContext.java @@ -35,8 +35,8 @@ import java.lang.annotation.Target; * will be supplied a new context. * *

{@code @DirtiesContext} may be used as a class-level and method-level - * annotation within the same class or class hierarchy. In such scenarios, the - * {@code ApplicationContext} will be marked as dirty before or + * annotation within the same test class or test class hierarchy. In such scenarios, + * the {@code ApplicationContext} will be marked as dirty before or * after any such annotated method as well as before or after the current test * class, depending on the configured {@link #methodMode} and {@link #classMode}. * When {@code @DirtiesContext} is declared at both the class level and the diff --git a/spring-test/src/main/java/org/springframework/test/annotation/IfProfileValue.java b/spring-test/src/main/java/org/springframework/test/annotation/IfProfileValue.java index 6eee643cc9f..9af1ec7492e 100644 --- a/spring-test/src/main/java/org/springframework/test/annotation/IfProfileValue.java +++ b/spring-test/src/main/java/org/springframework/test/annotation/IfProfileValue.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,8 +24,8 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * Test annotation for use with JUnit 4 to indicate whether a test is enabled or - * disabled for a specific testing profile. + * Test annotation for use with JUnit 4 to indicate whether the annotated test + * class or test method is enabled or disabled for a specific testing profile. * *

In the context of this annotation, the term profile refers to * a Java system property by default; however, the semantics can be changed diff --git a/spring-test/src/main/java/org/springframework/test/annotation/ProfileValueSourceConfiguration.java b/spring-test/src/main/java/org/springframework/test/annotation/ProfileValueSourceConfiguration.java index 4197550f26f..37af23cb3d2 100644 --- a/spring-test/src/main/java/org/springframework/test/annotation/ProfileValueSourceConfiguration.java +++ b/spring-test/src/main/java/org/springframework/test/annotation/ProfileValueSourceConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,8 +24,8 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * {@code ProfileValueSourceConfiguration} is a class-level annotation for use - * with JUnit 4 which is used to specify what type of {@link ProfileValueSource} + * {@code ProfileValueSourceConfiguration} is an annotation that can be applied + * to a JUnit 4 based test class to specify what type of {@link ProfileValueSource} * to use when retrieving profile values configured via * {@link IfProfileValue @IfProfileValue}. * diff --git a/spring-test/src/main/java/org/springframework/test/context/ActiveProfiles.java b/spring-test/src/main/java/org/springframework/test/context/ActiveProfiles.java index dc5711b7fec..97d5959319a 100644 --- a/spring-test/src/main/java/org/springframework/test/context/ActiveProfiles.java +++ b/spring-test/src/main/java/org/springframework/test/context/ActiveProfiles.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import java.lang.annotation.Target; import org.springframework.core.annotation.AliasFor; /** - * {@code ActiveProfiles} is a class-level annotation that is used to declare - * which active bean definition profiles should be used when loading - * an {@link org.springframework.context.ApplicationContext ApplicationContext} - * for test classes. + * {@code ActiveProfiles} is an annotation that can be applied to a test class + * to declare which active bean definition profiles should be used when + * loading an {@link org.springframework.context.ApplicationContext ApplicationContext} + * for integration tests. * *

This annotation may be used as a meta-annotation to create custom * composed annotations. diff --git a/spring-test/src/main/java/org/springframework/test/context/BootstrapWith.java b/spring-test/src/main/java/org/springframework/test/context/BootstrapWith.java index 1a00c818d45..a2f761d46a6 100644 --- a/spring-test/src/main/java/org/springframework/test/context/BootstrapWith.java +++ b/spring-test/src/main/java/org/springframework/test/context/BootstrapWith.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,8 +24,9 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * {@code @BootstrapWith} defines class-level metadata that is used to determine - * how to bootstrap the Spring TestContext Framework. + * {@code @BootstrapWith} is an annotation that can be applied to a test class + * to define metadata that is used to determine how to bootstrap the + * Spring TestContext Framework. * *

This annotation may also be used as a meta-annotation to create * custom composed annotations. As of Spring Framework 5.1, a locally diff --git a/spring-test/src/main/java/org/springframework/test/context/ContextConfiguration.java b/spring-test/src/main/java/org/springframework/test/context/ContextConfiguration.java index e4680df48af..90bb738b777 100644 --- a/spring-test/src/main/java/org/springframework/test/context/ContextConfiguration.java +++ b/spring-test/src/main/java/org/springframework/test/context/ContextConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,9 +28,10 @@ import org.springframework.context.ConfigurableApplicationContext; import org.springframework.core.annotation.AliasFor; /** - * {@code @ContextConfiguration} defines class-level metadata that is used to determine - * how to load and configure an {@link org.springframework.context.ApplicationContext - * ApplicationContext} for integration tests. + * {@code @ContextConfiguration} is an annotation that can be applied to a test + * class to define metadata that is used to determine how to load and configure + * an {@link org.springframework.context.ApplicationContext ApplicationContext} + * for integration tests. * *

Supported Resource Types

* diff --git a/spring-test/src/main/java/org/springframework/test/context/ContextCustomizerFactories.java b/spring-test/src/main/java/org/springframework/test/context/ContextCustomizerFactories.java index 25ebff330f7..2ed89c67aba 100644 --- a/spring-test/src/main/java/org/springframework/test/context/ContextCustomizerFactories.java +++ b/spring-test/src/main/java/org/springframework/test/context/ContextCustomizerFactories.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,9 +26,9 @@ import java.lang.annotation.Target; import org.springframework.core.annotation.AliasFor; /** - * {@code @ContextCustomizerFactories} defines class-level metadata for configuring - * which {@link ContextCustomizerFactory} implementations should be registered with - * the Spring TestContext Framework. + * {@code @ContextCustomizerFactories} is an annotation that can be applied to a + * test class to configure which {@link ContextCustomizerFactory} implementations + * should be registered with the Spring TestContext Framework. * *

{@code @ContextCustomizerFactories} is used to register factories for a * particular test class, its subclasses, and its nested classes. If you wish to diff --git a/spring-test/src/main/java/org/springframework/test/context/ContextHierarchy.java b/spring-test/src/main/java/org/springframework/test/context/ContextHierarchy.java index 9c298106f31..0785c965f8c 100644 --- a/spring-test/src/main/java/org/springframework/test/context/ContextHierarchy.java +++ b/spring-test/src/main/java/org/springframework/test/context/ContextHierarchy.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,8 +24,8 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * {@code @ContextHierarchy} is a class-level annotation that is used to define - * a hierarchy of {@link org.springframework.context.ApplicationContext + * {@code @ContextHierarchy} is an annotation that can be applied to a test class + * to define a hierarchy of {@link org.springframework.context.ApplicationContext * ApplicationContexts} for integration tests. * *

Examples

diff --git a/spring-test/src/main/java/org/springframework/test/context/DynamicPropertySource.java b/spring-test/src/main/java/org/springframework/test/context/DynamicPropertySource.java index 57732968e75..c21bb6b05e9 100644 --- a/spring-test/src/main/java/org/springframework/test/context/DynamicPropertySource.java +++ b/spring-test/src/main/java/org/springframework/test/context/DynamicPropertySource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,8 +23,9 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * Method-level annotation for integration tests that need to add properties with - * dynamic values to the {@code Environment}'s set of {@code PropertySources}. + * {@code @DynamicPropertySource} is an annotation that can be applied to methods + * in integration test classes that need to add properties with dynamic values to + * the {@code Environment}'s set of {@code PropertySources}. * *

This annotation and its supporting infrastructure were originally designed * to allow properties from diff --git a/spring-test/src/main/java/org/springframework/test/context/NestedTestConfiguration.java b/spring-test/src/main/java/org/springframework/test/context/NestedTestConfiguration.java index 3686560b7a1..c090ddb3512 100644 --- a/spring-test/src/main/java/org/springframework/test/context/NestedTestConfiguration.java +++ b/spring-test/src/main/java/org/springframework/test/context/NestedTestConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,9 +29,9 @@ import org.apache.commons.logging.LogFactory; import org.springframework.lang.Nullable; /** - * {@code @NestedTestConfiguration} is a type-level annotation that is used to - * configure how Spring test configuration annotations are processed within - * enclosing class hierarchies (i.e., for inner test classes). + * {@code @NestedTestConfiguration} is an annotation that can be applied to a test + * class to configure how Spring test configuration annotations are processed + * within enclosing class hierarchies (i.e., for inner test classes). * *

If {@code @NestedTestConfiguration} is not present or * meta-present on a test class, in its supertype hierarchy, or in its diff --git a/spring-test/src/main/java/org/springframework/test/context/TestConstructor.java b/spring-test/src/main/java/org/springframework/test/context/TestConstructor.java index 74ebda799dd..a8689773120 100644 --- a/spring-test/src/main/java/org/springframework/test/context/TestConstructor.java +++ b/spring-test/src/main/java/org/springframework/test/context/TestConstructor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,9 +29,9 @@ import org.apache.commons.logging.LogFactory; import org.springframework.lang.Nullable; /** - * {@code @TestConstructor} is a type-level annotation that is used to configure - * how the parameters of a test class constructor are autowired from components - * in the test's {@link org.springframework.context.ApplicationContext + * {@code @TestConstructor} is an annotation that can be applied to a test class + * to configure how the parameters of a test class constructor are autowired from + * components in the test's {@link org.springframework.context.ApplicationContext * ApplicationContext}. * *

If {@code @TestConstructor} is not present or meta-present diff --git a/spring-test/src/main/java/org/springframework/test/context/TestExecutionListeners.java b/spring-test/src/main/java/org/springframework/test/context/TestExecutionListeners.java index c4c26de1b7a..23b761629a4 100644 --- a/spring-test/src/main/java/org/springframework/test/context/TestExecutionListeners.java +++ b/spring-test/src/main/java/org/springframework/test/context/TestExecutionListeners.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,9 +26,9 @@ import java.lang.annotation.Target; import org.springframework.core.annotation.AliasFor; /** - * {@code TestExecutionListeners} defines class-level metadata for configuring - * which {@link TestExecutionListener TestExecutionListeners} should be - * registered with a {@link TestContextManager}. + * {@code @TestExecutionListeners} is an annotation that can be applied to a test + * class to configure which {@link TestExecutionListener TestExecutionListeners} + * should be registered with a {@link TestContextManager}. * *

{@code @TestExecutionListeners} is used to register listeners for a * particular test class, its subclasses, and its nested classes. If you wish to diff --git a/spring-test/src/main/java/org/springframework/test/context/TestPropertySource.java b/spring-test/src/main/java/org/springframework/test/context/TestPropertySource.java index 2eadd60be16..3a44d0f129d 100644 --- a/spring-test/src/main/java/org/springframework/test/context/TestPropertySource.java +++ b/spring-test/src/main/java/org/springframework/test/context/TestPropertySource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,8 +28,8 @@ import org.springframework.core.annotation.AliasFor; import org.springframework.core.io.support.PropertySourceFactory; /** - * {@code @TestPropertySource} is a class-level annotation that is used to - * configure the {@link #locations} of properties files and inlined + * {@code @TestPropertySource} is an annotation that can be applied to a test + * class to configure the {@link #locations} of properties files and inlined * {@link #properties} to be added to the {@code Environment}'s set of * {@code PropertySources} for an * {@link org.springframework.context.ApplicationContext ApplicationContext} diff --git a/spring-test/src/main/java/org/springframework/test/context/aot/DisabledInAotMode.java b/spring-test/src/main/java/org/springframework/test/context/aot/DisabledInAotMode.java index 2a322d2e456..c23454bc813 100644 --- a/spring-test/src/main/java/org/springframework/test/context/aot/DisabledInAotMode.java +++ b/spring-test/src/main/java/org/springframework/test/context/aot/DisabledInAotMode.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ import java.lang.annotation.Target; import org.junit.jupiter.api.extension.ExtendWith; /** - * {@code @DisabledInAotMode} signals that an annotated test class is disabled + * {@code @DisabledInAotMode} signals that the annotated test class is disabled * in Spring AOT (ahead-of-time) mode, which means that the {@code ApplicationContext} * for the test class will not be processed for AOT optimizations at build time. * diff --git a/spring-test/src/main/java/org/springframework/test/context/event/RecordApplicationEvents.java b/spring-test/src/main/java/org/springframework/test/context/event/RecordApplicationEvents.java index 5f74660a5d6..b4db02f945c 100644 --- a/spring-test/src/main/java/org/springframework/test/context/event/RecordApplicationEvents.java +++ b/spring-test/src/main/java/org/springframework/test/context/event/RecordApplicationEvents.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,8 +24,8 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * {@code @RecordApplicationEvents} is a class-level annotation that is used to - * instruct the Spring TestContext Framework to record all + * {@code @RecordApplicationEvents} is an annotation that can be applied to a test + * class to instruct the Spring TestContext Framework to record all * {@linkplain org.springframework.context.ApplicationEvent application events} * that are published in the {@link org.springframework.context.ApplicationContext * ApplicationContext} during the execution of a single test, either from the diff --git a/spring-test/src/main/java/org/springframework/test/context/web/WebAppConfiguration.java b/spring-test/src/main/java/org/springframework/test/context/web/WebAppConfiguration.java index 7b5e4520b1c..8fbae866496 100644 --- a/spring-test/src/main/java/org/springframework/test/context/web/WebAppConfiguration.java +++ b/spring-test/src/main/java/org/springframework/test/context/web/WebAppConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,9 +24,9 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * {@code @WebAppConfiguration} is a class-level annotation that is used to - * declare that the {@code ApplicationContext} loaded for an integration test - * should be a {@link org.springframework.web.context.WebApplicationContext + * {@code @WebAppConfiguration} is an annotation that can be applied to a test + * class to declare that the {@code ApplicationContext} loaded for an integration + * test should be a {@link org.springframework.web.context.WebApplicationContext * WebApplicationContext}. * *

The presence of {@code @WebAppConfiguration} on a test class indicates that