Clarify supported targets for annotations in the TestContext framework

Closes gh-32772
This commit is contained in:
Sam Brannen
2024-05-07 16:45:12 +03:00
parent 3048cfe9d9
commit ac0136b75c
30 changed files with 111 additions and 107 deletions

View File

@@ -35,8 +35,8 @@ import java.lang.annotation.Target;
* will be supplied a new context.
*
* <p>{@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 <em>dirty</em> before or
* annotation within the same test class or test class hierarchy. In such scenarios,
* the {@code ApplicationContext} will be marked as <em>dirty</em> 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

View File

@@ -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.
*
* <p>In the context of this annotation, the term <em>profile</em> refers to
* a Java system property by default; however, the semantics can be changed

View File

@@ -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 <em>profile values</em> configured via
* {@link IfProfileValue @IfProfileValue}.
*

View File

@@ -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 <em>active bean definition profiles</em> 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 <em>active bean definition profiles</em> should be used when
* loading an {@link org.springframework.context.ApplicationContext ApplicationContext}
* for integration tests.
*
* <p>This annotation may be used as a <em>meta-annotation</em> to create custom
* <em>composed annotations</em>.

View File

@@ -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 <em>Spring TestContext Framework</em>.
* {@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
* <em>Spring TestContext Framework</em>.
*
* <p>This annotation may also be used as a <em>meta-annotation</em> to create
* custom <em>composed annotations</em>. As of Spring Framework 5.1, a locally

View File

@@ -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.
*
* <h3>Supported Resource Types</h3>
*

View File

@@ -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 <em>Spring TestContext Framework</em>.
* {@code @ContextCustomizerFactories} is an annotation that can be applied to a
* test class to configure which {@link ContextCustomizerFactory} implementations
* should be registered with the <em>Spring TestContext Framework</em>.
*
* <p>{@code @ContextCustomizerFactories} is used to register factories for a
* particular test class, its subclasses, and its nested classes. If you wish to

View File

@@ -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.
*
* <h3>Examples</h3>

View File

@@ -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}.
*
* <p>This annotation and its supporting infrastructure were originally designed
* to allow properties from

View File

@@ -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 <em>inner</em> 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 <em>inner</em> test classes).
*
* <p>If {@code @NestedTestConfiguration} is not <em>present</em> or
* <em>meta-present</em> on a test class, in its supertype hierarchy, or in its

View File

@@ -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}.
*
* <p>If {@code @TestConstructor} is not <em>present</em> or <em>meta-present</em>

View File

@@ -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}.
*
* <p>{@code @TestExecutionListeners} is used to register listeners for a
* particular test class, its subclasses, and its nested classes. If you wish to

View File

@@ -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}

View File

@@ -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 <em>disabled</em>
* {@code @DisabledInAotMode} signals that the annotated test class is <em>disabled</em>
* 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.
*

View File

@@ -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 <em>Spring TestContext Framework</em> to record all
* {@code @RecordApplicationEvents} is an annotation that can be applied to a test
* class to instruct the <em>Spring TestContext Framework</em> 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

View File

@@ -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}.
*
* <p>The presence of {@code @WebAppConfiguration} on a test class indicates that