Package org.springframework.test.context
@NullMarked
package org.springframework.test.context
This package contains the Spring TestContext Framework which
provides annotation-driven unit and integration testing support that is
agnostic of the actual testing framework in use. The same techniques and
annotation-based configuration used in, for example, a JUnit environment
can also be applied to tests written with TestNG, etc.
In addition to providing generic and extensible testing infrastructure, the Spring TestContext Framework provides out-of-the-box support for Spring-specific integration testing functionality such as context management and caching, dependency injection of test fixtures, and transactional test management with default rollback semantics.
-
ClassDescription
ActiveProfilesis an annotation that can be applied to a test class to declare which active bean definition profiles should be used when loading anApplicationContextfor integration tests.Strategy interface for programmatically resolving which active bean definition profiles should be used when loading anApplicationContextfor a test class.Strategy for components that process failures related to application contexts within the Spring TestContext Framework.BootstrapContextencapsulates the context in which the Spring TestContext Framework is bootstrapped.BootstrapUtilsis a collection of utility methods to assist with bootstrapping the Spring TestContext Framework.@BootstrapWithis 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.ACacheAwareContextLoaderDelegateis responsible for loading and closing application contexts, interacting transparently with aContextCachebehind the scenes.@ContextConfigurationis an annotation that can be applied to a test class to define metadata that is used to determine how to load and configure anApplicationContextfor integration tests.ContextConfigurationAttributesencapsulates the context configuration attributes declared via@ContextConfiguration.Strategy interface for customizingapplication contextsthat are created and managed by the Spring TestContext Framework.@ContextCustomizerFactoriesis an annotation that can be applied to a test class to configure whichContextCustomizerFactoryimplementations should be registered with the Spring TestContext Framework.Enumeration of modes that dictate whether explicitly declared factories are merged with the default factories when@ContextCustomizerFactoriesis declared on a class that does not inherit factories from a superclass or enclosing class.Factory for creatingContextCustomizers.@ContextHierarchyis an annotation that can be applied to a test class to define a hierarchy ofApplicationContextsfor integration tests.Strategy interface for loading anApplicationContextfor an integration test managed by the Spring TestContext Framework.Exception thrown when an error occurs while aSmartContextLoaderattempts to load anApplicationContext.Registrar that is used to add properties with dynamically resolved values to theEnvironmentvia aDynamicPropertyRegistry.Registry that is used to add properties with dynamically resolved values to theEnvironment.@DynamicPropertySourceis an annotation that can be applied to static methods in integration test classes in order to add properties with dynamic values to theEnvironment's set ofPropertySources.MergedContextConfigurationencapsulates the merged context configuration declared on a test class and all of its superclasses and enclosing classes via@ContextConfiguration,@ActiveProfiles, and@TestPropertySource.MethodInvokerdefines a generic API for invoking aMethodwithin the Spring TestContext Framework.@NestedTestConfigurationis 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).Enumeration of modes that dictate how test configuration from enclosing classes is processed for inner test classes.Strategy interface for loading anApplicationContextfor an integration test managed by the Spring TestContext Framework.@TestConstructoris 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'sApplicationContext.Defines autowiring modes for parameters in a test constructor.TestContextencapsulates the context in which a test is executed, agnostic of the actual testing framework in use.TestContextAnnotationUtilsis a collection of utility methods that complements the standard support already available inMergedAnnotations,AnnotationUtils, andAnnotatedElementUtils, while transparently honoring@NestedTestConfigurationsemantics.Descriptor for anAnnotation, including the class on which the annotation is declared as well as the merged annotation instance.Untyped extension ofTestContextAnnotationUtils.AnnotationDescriptorthat is used to describe the declaration of one of several candidate annotation types where the actual annotation type cannot be predetermined.TestContextBootstrapperdefines the SPI for bootstrapping the Spring TestContext Framework.TestContextManageris the main entry point into the Spring TestContext Framework.TestExecutionListenerdefines a listener API for reacting to test execution events published by theTestContextManagerwith which the listener is registered.@TestExecutionListenersis an annotation that can be applied to a test class to configure whichTestExecutionListenersshould be registered with aTestContextManager.Enumeration of modes that dictate whether explicitly declared listeners are merged with the default listeners when@TestExecutionListenersis declared on a class that does not inherit listeners from a superclass or enclosing class.@TestPropertySourceis an annotation that can be applied to a test class to configure theTestPropertySource.locations()of properties files and inlinedTestPropertySource.properties()to be added to theEnvironment's set ofPropertySourcesfor anApplicationContextfor integration tests.@TestPropertySourcesis a container for one or more@TestPropertySourcedeclarations.