Skip to content

Commit ac0136b

Browse files
committed
Clarify supported targets for annotations in the TestContext framework
Closes gh-32772
1 parent 3048cfe commit ac0136b

30 files changed

+111
-107
lines changed

framework-docs/modules/ROOT/pages/testing/annotations/integration-junit-jupiter.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ for further details.
165165
[[integration-testing-annotations-testconstructor]]
166166
== `@TestConstructor`
167167

168-
`@TestConstructor` is a type-level annotation that is used to configure how the parameters
169-
of a test class constructor are autowired from components in the test's
168+
`@TestConstructor` is an annotation that can be applied to a test class to configure how
169+
the parameters of a test class constructor are autowired from components in the test's
170170
`ApplicationContext`.
171171

172172
If `@TestConstructor` is not present or meta-present on a test class, the default _test
@@ -199,9 +199,9 @@ Spring Boot Test.
199199
[[integration-testing-annotations-nestedtestconfiguration]]
200200
== `@NestedTestConfiguration`
201201

202-
`@NestedTestConfiguration` is a type-level annotation that is used to configure how
203-
Spring test configuration annotations are processed within enclosing class hierarchies
204-
for inner test classes.
202+
`@NestedTestConfiguration` is an annotation that can be applied to a test class to
203+
configure how Spring test configuration annotations are processed within enclosing class
204+
hierarchies for inner test classes.
205205

206206
If `@NestedTestConfiguration` is not present or meta-present on a test class, in its
207207
supertype hierarchy, or in its enclosing class hierarchy, the default _enclosing

framework-docs/modules/ROOT/pages/testing/annotations/integration-junit4.adoc

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ xref:testing/testcontext-framework/support-classes.adoc#testcontext-junit4-runne
1313
[[integration-testing-annotations-junit4-ifprofilevalue]]
1414
== `@IfProfileValue`
1515

16-
`@IfProfileValue` indicates that the annotated test is enabled for a specific testing
17-
environment. If the configured `ProfileValueSource` returns a matching `value` for the
18-
provided `name`, the test is enabled. Otherwise, the test is disabled and, effectively,
19-
ignored.
16+
`@IfProfileValue` indicates that the annotated test class or test method is enabled for a
17+
specific testing environment. If the configured `ProfileValueSource` returns a matching
18+
`value` for the provided `name`, the test is enabled. Otherwise, the test is disabled
19+
and, effectively, ignored.
2020

2121
You can apply `@IfProfileValue` at the class level, the method level, or both.
2222
Class-level usage of `@IfProfileValue` takes precedence over method-level usage for any
@@ -90,11 +90,12 @@ Kotlin::
9090
[[integration-testing-annotations-junit4-profilevaluesourceconfiguration]]
9191
== `@ProfileValueSourceConfiguration`
9292

93-
`@ProfileValueSourceConfiguration` is a class-level annotation that specifies what type
94-
of `ProfileValueSource` to use when retrieving profile values configured through the
95-
`@IfProfileValue` annotation. If `@ProfileValueSourceConfiguration` is not declared for a
96-
test, `SystemProfileValueSource` is used by default. The following example shows how to
97-
use `@ProfileValueSourceConfiguration`:
93+
`@ProfileValueSourceConfiguration` is an annotation that can be applied to a test class
94+
to specify what type of `ProfileValueSource` to use when retrieving profile values
95+
configured through the `@IfProfileValue` annotation. If
96+
`@ProfileValueSourceConfiguration` is not declared for a test, `SystemProfileValueSource`
97+
is used by default. The following example shows how to use
98+
`@ProfileValueSourceConfiguration`:
9899

99100
[tabs]
100101
======

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[[spring-testing-annotation-activeprofiles]]
22
= `@ActiveProfiles`
33

4-
`@ActiveProfiles` is a class-level annotation that is used to declare which bean
5-
definition profiles should be active when loading an `ApplicationContext` for an
4+
`@ActiveProfiles` is an annotation that can be applied to a test class to declare which
5+
bean definition profiles should be active when loading an `ApplicationContext` for an
66
integration test.
77

88
The following example indicates that the `dev` profile should be active:

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
= `@BootstrapWith`
33
:page-section-summary-toc: 1
44

5-
`@BootstrapWith` is a class-level annotation that you can use to configure how the Spring
6-
TestContext Framework is bootstrapped. Specifically, you can use `@BootstrapWith` to
7-
specify a custom `TestContextBootstrapper`. See the section on
5+
`@BootstrapWith` is an annotation that can be applied to a test class to configure how
6+
the Spring TestContext Framework is bootstrapped. Specifically, you can use
7+
`@BootstrapWith` to specify a custom `TestContextBootstrapper`. See the section on
88
xref:testing/testcontext-framework/bootstrapping.adoc[bootstrapping the TestContext framework] for further details.
99

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[[spring-testing-annotation-contextconfiguration]]
22
= `@ContextConfiguration`
33

4-
`@ContextConfiguration` defines class-level metadata that is used to determine how to
5-
load and configure an `ApplicationContext` for integration tests. Specifically,
6-
`@ContextConfiguration` declares the application context resource `locations` or the
7-
component `classes` used to load the context.
4+
`@ContextConfiguration` is an annotation that can be applied to a test class to configure
5+
metadata that is used to determine how to load and configure an `ApplicationContext` for
6+
integration tests. Specifically, `@ContextConfiguration` declares the application context
7+
resource `locations` or the component `classes` used to load the context.
88

99
Resource locations are typically XML configuration files or Groovy scripts located in the
1010
classpath, while component classes are typically `@Configuration` classes. However,

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[[spring-testing-annotation-contextcustomizerfactories]]
22
= `@ContextCustomizerFactories`
33

4-
`@ContextCustomizerFactories` is used to register `ContextCustomizerFactory`
5-
implementations for a particular test class, its subclasses, and its nested classes. If
6-
you wish to register a factory globally, you should register it via the automatic
7-
discovery mechanism described in
4+
`@ContextCustomizerFactories` is an annotation that can be applied to a test class to
5+
register `ContextCustomizerFactory` implementations for the particular test class, its
6+
subclasses, and its nested classes. If you wish to register a factory globally, you
7+
should register it via the automatic discovery mechanism described in
88
xref:testing/testcontext-framework/ctx-management/context-customizers.adoc[`ContextCustomizerFactory` Configuration].
99

1010
The following example shows how to register two `ContextCustomizerFactory` implementations:

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[[spring-testing-annotation-contexthierarchy]]
22
= `@ContextHierarchy`
33

4-
`@ContextHierarchy` is a class-level annotation that is used to define a hierarchy of
5-
`ApplicationContext` instances for integration tests. `@ContextHierarchy` should be
6-
declared with a list of one or more `@ContextConfiguration` instances, each of which
7-
defines a level in the context hierarchy. The following examples demonstrate the use of
8-
`@ContextHierarchy` within a single test class (`@ContextHierarchy` can also be used
9-
within a test class hierarchy):
4+
`@ContextHierarchy` is an annotation that can be applied to a test class to define a
5+
hierarchy of `ApplicationContext` instances for integration tests. `@ContextHierarchy`
6+
should be declared with a list of one or more `@ContextConfiguration` instances, each of
7+
which defines a level in the context hierarchy. The following examples demonstrate the
8+
use of `@ContextHierarchy` within a single test class (`@ContextHierarchy` can also be
9+
used within a test class hierarchy):
1010

1111
[tabs]
1212
======

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ rebuilt for any subsequent test that requires a context with the same configurat
1010
metadata.
1111

1212
You can use `@DirtiesContext` as both a class-level and a method-level annotation within
13-
the same class or class hierarchy. In such scenarios, the `ApplicationContext` is marked
14-
as dirty before or after any such annotated method as well as before or after the current
15-
test class, depending on the configured `methodMode` and `classMode`. When
13+
the same test class or test class hierarchy. In such scenarios, the `ApplicationContext`
14+
is marked as dirty before or after any such annotated method as well as before or after
15+
the current test class, depending on the configured `methodMode` and `classMode`. When
1616
`@DirtiesContext` is declared at both the class level and the method level, the
1717
configured modes from both annotations will be honored. For example, if the class mode is
1818
set to `BEFORE_EACH_TEST_METHOD` and the method mode is set to `AFTER_METHOD`, the

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[[spring-testing-annotation-disabledinaotmode]]
22
= `@DisabledInAotMode`
33

4-
`@DisabledInAotMode` signals that an annotated test class is disabled in Spring AOT
4+
`@DisabledInAotMode` signals that the annotated test class is disabled in Spring AOT
55
(ahead-of-time) mode, which means that the `ApplicationContext` for the test class will
66
not be processed for AOT optimizations at build time.
77

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[[spring-testing-annotation-dynamicpropertysource]]
22
= `@DynamicPropertySource`
33

4-
`@DynamicPropertySource` is a method-level annotation that you can use to register
5-
_dynamic_ properties to be added to the set of `PropertySources` in the `Environment` for
6-
an `ApplicationContext` loaded for an integration test. Dynamic properties are useful
7-
when you do not know the value of the properties upfront – for example, if the properties
8-
are managed by an external resource such as for a container managed by the
9-
{testcontainers-site}[Testcontainers] project.
4+
`@DynamicPropertySource` is an annotation that can be applied to methods in integration
5+
test classes that need to register _dynamic_ properties to be added to the set of
6+
`PropertySources` in the `Environment` for an `ApplicationContext` loaded for an
7+
integration test. Dynamic properties are useful when you do not know the value of the
8+
properties upfront – for example, if the properties are managed by an external resource
9+
such as for a container managed by the {testcontainers-site}[Testcontainers] project.
1010

1111
The following example demonstrates how to register a dynamic property:
1212

0 commit comments

Comments
 (0)