Extract recurring asciidoc links to attributes, cleanup old doc files
This commit extract spring-related links and recurring external links into asciidoctor attributes to be used by the Antora toolchain. It notably homogenizes links to: - IETF RFCs - Java Community Process JSRs - the Java API Documentation (on the Java 17 version) - Kotlin documentations (on the Kotlinlang.org version) - the Spring Boot reference guide (on the `html` version) This commit also reworks most link attributes to follow a Project-Category-Misc syntax. For example, `spring-boot-docs` rather than `docs-spring-boot`. Finally, it makes an effort to clean up remainders from the previous documentation toolchain, namely the `docs/asciidoc` folder and `modules/ROOT/pages/attributes.adoc` file. Closes gh-26864 Closes gh-31619
This commit is contained in:
@@ -82,7 +82,7 @@ Kotlin::
|
||||
|
||||
|
||||
See xref:testing/testcontext-framework/ctx-management.adoc[Context Management] as well as the javadoc for
|
||||
{api-spring-framework}/test/context/junit/jupiter/SpringJUnitConfig.html[`@SpringJUnitConfig`]
|
||||
{spring-framework-api}/test/context/junit/jupiter/SpringJUnitConfig.html[`@SpringJUnitConfig`]
|
||||
and `@ContextConfiguration` for further details.
|
||||
|
||||
[[integration-testing-annotations-junit-jupiter-springjunitwebconfig]]
|
||||
@@ -157,9 +157,9 @@ Kotlin::
|
||||
|
||||
|
||||
See xref:testing/testcontext-framework/ctx-management.adoc[Context Management] as well as the javadoc for
|
||||
{api-spring-framework}/test/context/junit/jupiter/web/SpringJUnitWebConfig.html[`@SpringJUnitWebConfig`],
|
||||
{api-spring-framework}/test/context/ContextConfiguration.html[`@ContextConfiguration`], and
|
||||
{api-spring-framework}/test/context/web/WebAppConfiguration.html[`@WebAppConfiguration`]
|
||||
{spring-framework-api}/test/context/junit/jupiter/web/SpringJUnitWebConfig.html[`@SpringJUnitWebConfig`],
|
||||
{spring-framework-api}/test/context/ContextConfiguration.html[`@ContextConfiguration`], and
|
||||
{spring-framework-api}/test/context/web/WebAppConfiguration.html[`@WebAppConfiguration`]
|
||||
for further details.
|
||||
|
||||
[[integration-testing-annotations-testconstructor]]
|
||||
|
||||
@@ -305,5 +305,5 @@ Kotlin::
|
||||
======
|
||||
|
||||
For further details, see the
|
||||
https://github.com/spring-projects/spring-framework/wiki/Spring-Annotation-Programming-Model[Spring Annotation Programming Model]
|
||||
{spring-framework-wiki}/Spring-Annotation-Programming-Model[Spring Annotation Programming Model]
|
||||
wiki page.
|
||||
|
||||
@@ -74,6 +74,6 @@ and registering it by using the `resolver` attribute of `@ActiveProfiles`.
|
||||
|
||||
See xref:testing/testcontext-framework/ctx-management/env-profiles.adoc[Context Configuration with Environment Profiles],
|
||||
xref:testing/testcontext-framework/support-classes.adoc#testcontext-junit-jupiter-nested-test-configuration[`@Nested` test class configuration], and the
|
||||
{api-spring-framework}/test/context/ActiveProfiles.html[`@ActiveProfiles`] javadoc for
|
||||
{spring-framework-api}/test/context/ActiveProfiles.html[`@ActiveProfiles`] javadoc for
|
||||
examples and further details.
|
||||
|
||||
|
||||
@@ -40,6 +40,6 @@ Kotlin::
|
||||
By default, `@ContextCustomizerFactories` provides support for inheriting factories from
|
||||
superclasses or enclosing classes. See
|
||||
xref:testing/testcontext-framework/support-classes.adoc#testcontext-junit-jupiter-nested-test-configuration[`@Nested` test class configuration] and the
|
||||
{api-spring-framework}/test/context/ContextCustomizerFactories.html[`@ContextCustomizerFactories`
|
||||
{spring-framework-api}/test/context/ContextCustomizerFactories.html[`@ContextCustomizerFactories`
|
||||
javadoc] for an example and further details.
|
||||
|
||||
|
||||
@@ -70,6 +70,6 @@ If you need to merge or override the configuration for a given level of the cont
|
||||
hierarchy within a test class hierarchy, you must explicitly name that level by supplying
|
||||
the same value to the `name` attribute in `@ContextConfiguration` at each corresponding
|
||||
level in the class hierarchy. See xref:testing/testcontext-framework/ctx-management/hierarchies.adoc[Context Hierarchies] and the
|
||||
{api-spring-framework}/test/context/ContextHierarchy.html[`@ContextHierarchy`] javadoc
|
||||
{spring-framework-api}/test/context/ContextHierarchy.html[`@ContextHierarchy`] javadoc
|
||||
for further examples.
|
||||
|
||||
|
||||
@@ -257,6 +257,6 @@ Kotlin::
|
||||
|
||||
|
||||
For further details regarding the `EXHAUSTIVE` and `CURRENT_LEVEL` algorithms, see the
|
||||
{api-spring-framework}/test/annotation/DirtiesContext.HierarchyMode.html[`DirtiesContext.HierarchyMode`]
|
||||
{spring-framework-api}/test/annotation/DirtiesContext.HierarchyMode.html[`DirtiesContext.HierarchyMode`]
|
||||
javadoc.
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ _dynamic_ properties to be added to the set of `PropertySources` in the `Environ
|
||||
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
|
||||
https://www.testcontainers.org/[Testcontainers] project.
|
||||
{testcontainers-site}[Testcontainers] project.
|
||||
|
||||
The following example demonstrates how to register a dynamic property:
|
||||
|
||||
|
||||
@@ -9,6 +9,6 @@ _Spring TestContext Framework_ to record all application events that are publish
|
||||
The recorded events can be accessed via the `ApplicationEvents` API within tests.
|
||||
|
||||
See xref:testing/testcontext-framework/application-events.adoc[Application Events] and the
|
||||
{api-spring-framework}/test/context/event/RecordApplicationEvents.html[`@RecordApplicationEvents`
|
||||
{spring-framework-api}/test/context/event/RecordApplicationEvents.html[`@RecordApplicationEvents`
|
||||
javadoc] for an example and further details.
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ Kotlin::
|
||||
By default, `@TestExecutionListeners` provides support for inheriting listeners from
|
||||
superclasses or enclosing classes. See
|
||||
xref:testing/testcontext-framework/support-classes.adoc#testcontext-junit-jupiter-nested-test-configuration[`@Nested` test class configuration] and the
|
||||
{api-spring-framework}/test/context/TestExecutionListeners.html[`@TestExecutionListeners`
|
||||
{spring-framework-api}/test/context/TestExecutionListeners.html[`@TestExecutionListeners`
|
||||
javadoc] for an example and further details. If you discover that you need to switch
|
||||
back to using the default `TestExecutionListener` implementations, see the note
|
||||
in xref:testing/testcontext-framework/tel-config.adoc#testcontext-tel-config-registering-tels[Registering `TestExecutionListener` Implementations].
|
||||
|
||||
@@ -80,6 +80,6 @@ Kotlin::
|
||||
Note that `@WebAppConfiguration` must be used in conjunction with
|
||||
`@ContextConfiguration`, either within a single test class or within a test class
|
||||
hierarchy. See the
|
||||
{api-spring-framework}/test/context/web/WebAppConfiguration.html[`@WebAppConfiguration`]
|
||||
{spring-framework-api}/test/context/web/WebAppConfiguration.html[`@WebAppConfiguration`]
|
||||
javadoc for further details.
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ See the following resources for more information about testing:
|
||||
* https://testng.org/[TestNG]: A testing framework inspired by JUnit with added support
|
||||
for test groups, data-driven testing, distributed testing, and other features. Supported
|
||||
in the xref:testing/testcontext-framework.adoc[Spring TestContext Framework]
|
||||
* https://assertj.github.io/doc/[AssertJ]: "Fluent assertions for Java",
|
||||
* {assertj-docs}[AssertJ]: "Fluent assertions for Java",
|
||||
including support for Java 8 lambdas, streams, and numerous other features.
|
||||
* https://en.wikipedia.org/wiki/Mock_Object[Mock Objects]: Article in Wikipedia.
|
||||
* http://www.mockobjects.com/[MockObjects.com]: Web site dedicated to mock objects, a
|
||||
@@ -24,7 +24,7 @@ See the following resources for more information about testing:
|
||||
* https://www.dbunit.org/[DbUnit]: JUnit extension (also usable with Ant and Maven) that
|
||||
is targeted at database-driven projects and, among other things, puts your database into
|
||||
a known state between test runs.
|
||||
* https://www.testcontainers.org/[Testcontainers]: Java library that supports JUnit
|
||||
* {testcontainers-site}[Testcontainers]: Java library that supports JUnit
|
||||
tests, providing lightweight, throwaway instances of common databases, Selenium web
|
||||
browsers, or anything else that can run in a Docker container.
|
||||
* https://sourceforge.net/projects/grinder/[The Grinder]: Java load testing framework.
|
||||
|
||||
@@ -211,5 +211,5 @@ configuration. Check for the support for code completion on static members.
|
||||
== Further Examples of Client-side REST Tests
|
||||
|
||||
Spring MVC Test's own tests include
|
||||
{spring-framework-main-code}/spring-test/src/test/java/org/springframework/test/web/client/samples[example
|
||||
{spring-framework-code}/spring-test/src/test/java/org/springframework/test/web/client/samples[example
|
||||
tests] of client-side REST tests.
|
||||
|
||||
@@ -184,7 +184,7 @@ Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
----
|
||||
// Not possible in Kotlin until https://youtrack.jetbrains.com/issue/KT-22208 is fixed
|
||||
// Not possible in Kotlin until {kotlin-issues}/KT-22208 is fixed
|
||||
----
|
||||
======
|
||||
|
||||
@@ -192,7 +192,7 @@ Note that common expectations are always applied and cannot be overridden withou
|
||||
creating a separate `MockMvc` instance.
|
||||
|
||||
When a JSON response content contains hypermedia links created with
|
||||
https://github.com/spring-projects/spring-hateoas[Spring HATEOAS], you can verify the
|
||||
{spring-github-org}/spring-hateoas[Spring HATEOAS], you can verify the
|
||||
resulting links by using JsonPath expressions, as the following example shows:
|
||||
|
||||
[tabs]
|
||||
@@ -220,7 +220,7 @@ Kotlin::
|
||||
======
|
||||
|
||||
When XML response content contains hypermedia links created with
|
||||
https://github.com/spring-projects/spring-hateoas[Spring HATEOAS], you can verify the
|
||||
{spring-github-org}/spring-hateoas[Spring HATEOAS], you can verify the
|
||||
resulting links by using XPath expressions:
|
||||
|
||||
[tabs]
|
||||
|
||||
@@ -18,7 +18,7 @@ Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
----
|
||||
// Not possible in Kotlin until https://youtrack.jetbrains.com/issue/KT-22208 is fixed
|
||||
// Not possible in Kotlin until {kotlin-issues}/KT-22208 is fixed
|
||||
----
|
||||
======
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ Kotlin::
|
||||
======
|
||||
|
||||
Finally, we can verify that a new message was created successfully. The following
|
||||
assertions use the https://assertj.github.io/doc/[AssertJ] library:
|
||||
assertions use the {assertj-docs}[AssertJ] library:
|
||||
|
||||
[tabs]
|
||||
======
|
||||
@@ -268,7 +268,7 @@ Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
----
|
||||
// Not possible in Kotlin until https://youtrack.jetbrains.com/issue/KT-22208 is fixed
|
||||
// Not possible in Kotlin until {kotlin-issues}/KT-22208 is fixed
|
||||
----
|
||||
======
|
||||
|
||||
|
||||
@@ -362,7 +362,7 @@ annotation to look up our submit button with a `css` selector (*input[type=submi
|
||||
--
|
||||
|
||||
Finally, we can verify that a new message was created successfully. The following
|
||||
assertions use the https://assertj.github.io/doc/[AssertJ] assertion library:
|
||||
assertions use the {assertj-docs}[AssertJ] assertion library:
|
||||
|
||||
--
|
||||
[tabs]
|
||||
@@ -562,7 +562,7 @@ Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
----
|
||||
// Not possible in Kotlin until https://youtrack.jetbrains.com/issue/KT-22208 is fixed
|
||||
// Not possible in Kotlin until {kotlin-issues}/KT-22208 is fixed
|
||||
----
|
||||
======
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
----
|
||||
// Not possible in Kotlin until https://youtrack.jetbrains.com/issue/KT-22208 is fixed
|
||||
// Not possible in Kotlin until {kotlin-issues}/KT-22208 is fixed
|
||||
----
|
||||
======
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
:page-section-summary-toc: 1
|
||||
|
||||
The framework's own tests include
|
||||
{spring-framework-main-code}/spring-test/src/test/java/org/springframework/test/web/servlet/samples[
|
||||
{spring-framework-code}/spring-test/src/test/java/org/springframework/test/web/servlet/samples[
|
||||
many sample tests] intended to show how to use MockMvc on its own or through the
|
||||
{spring-framework-main-code}/spring-test/src/test/java/org/springframework/test/web/servlet/samples/client[
|
||||
{spring-framework-code}/spring-test/src/test/java/org/springframework/test/web/servlet/samples/client[
|
||||
WebTestClient]. Browse these examples for further ideas.
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
----
|
||||
// Not possible in Kotlin until https://youtrack.jetbrains.com/issue/KT-22208 is fixed
|
||||
// Not possible in Kotlin until {kotlin-issues}/KT-22208 is fixed
|
||||
----
|
||||
======
|
||||
|
||||
@@ -53,11 +53,11 @@ Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
----
|
||||
// Not possible in Kotlin until https://youtrack.jetbrains.com/issue/KT-22208 is fixed
|
||||
// Not possible in Kotlin until {kotlin-issues}/KT-22208 is fixed
|
||||
----
|
||||
======
|
||||
|
||||
See the javadoc for
|
||||
{api-spring-framework}/test/web/servlet/setup/ConfigurableMockMvcBuilder.html[`ConfigurableMockMvcBuilder`]
|
||||
{spring-framework-api}/test/web/servlet/setup/ConfigurableMockMvcBuilder.html[`ConfigurableMockMvcBuilder`]
|
||||
for a list of all MockMvc builder features or use the IDE to explore the available options.
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ for rendering JSON, XML, and other formats through `@ResponseBody` methods.
|
||||
|
||||
Alternatively, you may consider the full end-to-end integration testing support from
|
||||
Spring Boot with `@SpringBootTest`. See the
|
||||
{docs-spring-boot}/html/spring-boot-features.html#boot-features-testing[Spring Boot Reference Guide].
|
||||
{spring-boot-docs}/spring-boot-features.html#boot-features-testing[Spring Boot Reference Guide].
|
||||
|
||||
There are pros and cons for each approach. The options provided in Spring MVC Test are
|
||||
different stops on the scale from classic unit testing to full integration testing. To be
|
||||
|
||||
@@ -33,6 +33,6 @@ Java::
|
||||
|
||||
`WebTestClient` can also connect to a live server and perform full end-to-end integration
|
||||
tests. This is also supported in Spring Boot where you can
|
||||
{docs-spring-boot}/html/spring-boot-features.html#boot-features-testing-spring-boot-applications-testing-with-running-server[test a running server].
|
||||
{spring-boot-docs}/spring-boot-features.html#boot-features-testing-spring-boot-applications-testing-with-running-server[test a running server].
|
||||
|
||||
|
||||
|
||||
@@ -52,13 +52,13 @@ To provide test-specific runtime hints for use within a GraalVM native image, yo
|
||||
the following options.
|
||||
|
||||
* Implement a custom
|
||||
{api-spring-framework}/test/context/aot/TestRuntimeHintsRegistrar.html[`TestRuntimeHintsRegistrar`]
|
||||
{spring-framework-api}/test/context/aot/TestRuntimeHintsRegistrar.html[`TestRuntimeHintsRegistrar`]
|
||||
and register it globally via `META-INF/spring/aot.factories`.
|
||||
* Implement a custom {api-spring-framework}/aot/hint/RuntimeHintsRegistrar.html[`RuntimeHintsRegistrar`]
|
||||
* Implement a custom {spring-framework-api}/aot/hint/RuntimeHintsRegistrar.html[`RuntimeHintsRegistrar`]
|
||||
and register it globally via `META-INF/spring/aot.factories` or locally on a test class
|
||||
via {api-spring-framework}/context/annotation/ImportRuntimeHints.html[`@ImportRuntimeHints`].
|
||||
* Annotate a test class with {api-spring-framework}/aot/hint/annotation/Reflective.html[`@Reflective`] or
|
||||
{api-spring-framework}/aot/hint/annotation/RegisterReflectionForBinding.html[`@RegisterReflectionForBinding`].
|
||||
via {spring-framework-api}/context/annotation/ImportRuntimeHints.html[`@ImportRuntimeHints`].
|
||||
* Annotate a test class with {spring-framework-api}/aot/hint/annotation/Reflective.html[`@Reflective`] or
|
||||
{spring-framework-api}/aot/hint/annotation/RegisterReflectionForBinding.html[`@RegisterReflectionForBinding`].
|
||||
* See xref:core/aot.adoc#aot.hints[Runtime Hints] for details on Spring's core runtime hints
|
||||
and annotation support.
|
||||
|
||||
@@ -71,12 +71,12 @@ that are not specific to particular test classes, favor implementing
|
||||
====
|
||||
|
||||
If you implement a custom `ContextLoader`, it must implement
|
||||
{api-spring-framework}/test/context/aot/AotContextLoader.html[`AotContextLoader`] in
|
||||
{spring-framework-api}/test/context/aot/AotContextLoader.html[`AotContextLoader`] in
|
||||
order to provide AOT build-time processing and AOT runtime execution support. Note,
|
||||
however, that all context loader implementations provided by the Spring Framework and
|
||||
Spring Boot already implement `AotContextLoader`.
|
||||
|
||||
If you implement a custom `TestExecutionListener`, it must implement
|
||||
{api-spring-framework}/test/context/aot/AotTestExecutionListener.html[`AotTestExecutionListener`]
|
||||
{spring-framework-api}/test/context/aot/AotTestExecutionListener.html[`AotTestExecutionListener`]
|
||||
in order to participate in AOT processing. See the `SqlScriptsTestExecutionListener` in
|
||||
the `spring-test` module for an example.
|
||||
|
||||
@@ -24,7 +24,7 @@ To use `ApplicationEvents` in your tests, do the following.
|
||||
to an `@Autowired` field in the test class.
|
||||
|
||||
The following test class uses the `SpringExtension` for JUnit Jupiter and
|
||||
https://assertj.github.io/doc/[AssertJ] to assert the types of application events
|
||||
{assertj-docs}[AssertJ] to assert the types of application events
|
||||
published while invoking a method in a Spring-managed component:
|
||||
|
||||
// Don't use "quotes" in the "subs" section because of the asterisks in /* ... */
|
||||
@@ -88,6 +88,6 @@ Kotlin::
|
||||
======
|
||||
|
||||
See the
|
||||
{api-spring-framework}/test/context/event/ApplicationEvents.html[`ApplicationEvents`
|
||||
{spring-framework-api}/test/context/event/ApplicationEvents.html[`ApplicationEvents`
|
||||
javadoc] for further details regarding the `ApplicationEvents` API.
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ You can register `ContextCustomizerFactory` implementations explicitly for a tes
|
||||
subclasses, and its nested classes by using the `@ContextCustomizerFactories` annotation. See
|
||||
xref:testing/annotations/integration-spring/annotation-contextcustomizerfactories.adoc[annotation support]
|
||||
and the javadoc for
|
||||
{api-spring-framework}/test/context/ContextCustomizerFactories.html[`@ContextCustomizerFactories`]
|
||||
{spring-framework-api}/test/context/ContextCustomizerFactories.html[`@ContextCustomizerFactories`]
|
||||
for details and examples.
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ integration test.
|
||||
====
|
||||
The `@DynamicPropertySource` annotation and its supporting infrastructure were
|
||||
originally designed to allow properties from
|
||||
https://www.testcontainers.org/[Testcontainers] based tests to be exposed easily to
|
||||
{testcontainers-site}[Testcontainers] based tests to be exposed easily to
|
||||
Spring integration tests. However, this feature may also be used with any form of
|
||||
external resource whose lifecycle is maintained outside the test's `ApplicationContext`.
|
||||
====
|
||||
|
||||
@@ -478,7 +478,7 @@ programmatically instead of declaratively -- for example, based on:
|
||||
To resolve active bean definition profiles programmatically, you can implement
|
||||
a custom `ActiveProfilesResolver` and register it by using the `resolver`
|
||||
attribute of `@ActiveProfiles`. For further information, see the corresponding
|
||||
{api-spring-framework}/test/context/ActiveProfilesResolver.html[javadoc].
|
||||
{spring-framework-api}/test/context/ActiveProfilesResolver.html[javadoc].
|
||||
The following example demonstrates how to implement and register a custom
|
||||
`OperatingSystemActiveProfilesResolver`:
|
||||
|
||||
|
||||
@@ -235,6 +235,6 @@ NOTE: If you use `@DirtiesContext` in a test whose context is configured as part
|
||||
context hierarchy, you can use the `hierarchyMode` flag to control how the context cache
|
||||
is cleared. For further details, see the discussion of `@DirtiesContext` in
|
||||
xref:testing/annotations/integration-spring/annotation-dirtiescontext.adoc[Spring Testing Annotations] and the
|
||||
{api-spring-framework}/test/annotation/DirtiesContext.html[`@DirtiesContext`] javadoc.
|
||||
{spring-framework-api}/test/annotation/DirtiesContext.html[`@DirtiesContext`] javadoc.
|
||||
--
|
||||
|
||||
|
||||
@@ -51,8 +51,8 @@ The term "`component class`" can refer to any of the following:
|
||||
of a single constructor without the use of Spring annotations.
|
||||
|
||||
See the javadoc of
|
||||
{api-spring-framework}/context/annotation/Configuration.html[`@Configuration`] and
|
||||
{api-spring-framework}/context/annotation/Bean.html[`@Bean`] for further information
|
||||
{spring-framework-api}/context/annotation/Configuration.html[`@Configuration`] and
|
||||
{spring-framework-api}/context/annotation/Bean.html[`@Bean`] for further information
|
||||
regarding the configuration and semantics of component classes, paying special attention
|
||||
to the discussion of `@Bean` Lite Mode.
|
||||
====
|
||||
@@ -62,7 +62,7 @@ TestContext framework tries to detect the presence of default configuration clas
|
||||
Specifically, `AnnotationConfigContextLoader` and `AnnotationConfigWebContextLoader`
|
||||
detect all `static` nested classes of the test class that meet the requirements for
|
||||
configuration class implementations, as specified in the
|
||||
{api-spring-framework}/context/annotation/Configuration.html[`@Configuration`] javadoc.
|
||||
{spring-framework-api}/context/annotation/Configuration.html[`@Configuration`] javadoc.
|
||||
Note that the name of the configuration class is arbitrary. In addition, a test class can
|
||||
contain more than one `static` nested configuration class if desired. In the following
|
||||
example, the `OrderServiceTest` class declares a `static` nested configuration class
|
||||
|
||||
@@ -29,7 +29,7 @@ integration test methods.
|
||||
scripts and is mainly intended for internal use within the framework. However, if you
|
||||
require full control over how SQL scripts are parsed and run, `ScriptUtils` may suit
|
||||
your needs better than some of the other alternatives described later. See the
|
||||
{api-spring-framework}/jdbc/datasource/init/ScriptUtils.html[javadoc] for individual
|
||||
{spring-framework-api}/jdbc/datasource/init/ScriptUtils.html[javadoc] for individual
|
||||
methods in `ScriptUtils` for further details.
|
||||
|
||||
`ResourceDatabasePopulator` provides an object-based API for programmatically populating,
|
||||
@@ -38,7 +38,7 @@ resources. `ResourceDatabasePopulator` provides options for configuring the char
|
||||
encoding, statement separator, comment delimiters, and error handling flags used when
|
||||
parsing and running the scripts. Each of the configuration options has a reasonable
|
||||
default value. See the
|
||||
{api-spring-framework}/jdbc/datasource/init/ResourceDatabasePopulator.html[javadoc] for
|
||||
{spring-framework-api}/jdbc/datasource/init/ResourceDatabasePopulator.html[javadoc] for
|
||||
details on default values. To run the scripts configured in a
|
||||
`ResourceDatabasePopulator`, you can invoke either the `populate(Connection)` method to
|
||||
run the populator against a `java.sql.Connection` or the `execute(DataSource)` method
|
||||
@@ -392,8 +392,8 @@ local `@SqlConfig` attributes do not supply an explicit value other than `""`, `
|
||||
The configuration options provided by `@Sql` and `@SqlConfig` are equivalent to those
|
||||
supported by `ScriptUtils` and `ResourceDatabasePopulator` but are a superset of those
|
||||
provided by the `<jdbc:initialize-database/>` XML namespace element. See the javadoc of
|
||||
individual attributes in {api-spring-framework}/test/context/jdbc/Sql.html[`@Sql`] and
|
||||
{api-spring-framework}/test/context/jdbc/SqlConfig.html[`@SqlConfig`] for details.
|
||||
individual attributes in {spring-framework-api}/test/context/jdbc/Sql.html[`@Sql`] and
|
||||
{spring-framework-api}/test/context/jdbc/SqlConfig.html[`@SqlConfig`] for details.
|
||||
|
||||
[[testcontext-executing-sql-declaratively-tx]]
|
||||
==== Transaction management for `@Sql`
|
||||
@@ -415,8 +415,8 @@ behavior by setting the `transactionMode` attribute of `@SqlConfig` (for example
|
||||
scripts should be run in an isolated transaction). Although a thorough discussion of all
|
||||
supported options for transaction management with `@Sql` is beyond the scope of this
|
||||
reference manual, the javadoc for
|
||||
{api-spring-framework}/test/context/jdbc/SqlConfig.html[`@SqlConfig`] and
|
||||
{api-spring-framework}/test/context/jdbc/SqlScriptsTestExecutionListener.html[`SqlScriptsTestExecutionListener`]
|
||||
{spring-framework-api}/test/context/jdbc/SqlConfig.html[`@SqlConfig`] and
|
||||
{spring-framework-api}/test/context/jdbc/SqlScriptsTestExecutionListener.html[`SqlScriptsTestExecutionListener`]
|
||||
provide detailed information, and the following example shows a typical testing scenario
|
||||
that uses JUnit Jupiter and transactional tests with `@Sql`:
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ in turn, manages a `TestContext` that holds the context of the current test. The
|
||||
and delegates to `TestExecutionListener` implementations, which instrument the actual
|
||||
test execution by providing dependency injection, managing transactions, and so on. A
|
||||
`SmartContextLoader` is responsible for loading an `ApplicationContext` for a given test
|
||||
class. See the {api-spring-framework}/test/context/package-summary.html[javadoc] and the
|
||||
class. See the {spring-framework-api}/test/context/package-summary.html[javadoc] and the
|
||||
Spring test suite for further information and examples of various implementations.
|
||||
|
||||
[[testcontext]]
|
||||
|
||||
@@ -40,7 +40,7 @@ for details.
|
||||
|
||||
WARNING: Parallel test execution in the Spring TestContext Framework is only possible if
|
||||
the underlying `TestContext` implementation provides a copy constructor, as explained in
|
||||
the javadoc for {api-spring-framework}/test/context/TestContext.html[`TestContext`]. The
|
||||
the javadoc for {spring-framework-api}/test/context/TestContext.html[`TestContext`]. The
|
||||
`DefaultTestContext` used in Spring provides such a constructor. However, if you use a
|
||||
third-party library that provides a custom `TestContext` implementation, you need to
|
||||
verify that it is suitable for parallel test execution.
|
||||
|
||||
@@ -29,7 +29,7 @@ by default, exactly in the following order:
|
||||
You can register `TestExecutionListener` implementations explicitly for a test class, its
|
||||
subclasses, and its nested classes by using the `@TestExecutionListeners` annotation. See
|
||||
xref:testing/annotations.adoc[annotation support] and the javadoc for
|
||||
{api-spring-framework}/test/context/TestExecutionListeners.html[`@TestExecutionListeners`]
|
||||
{spring-framework-api}/test/context/TestExecutionListeners.html[`@TestExecutionListeners`]
|
||||
for details and examples.
|
||||
|
||||
.Switching to default `TestExecutionListener` implementations
|
||||
|
||||
@@ -216,7 +216,7 @@ Support for `TestTransaction` is automatically available whenever the
|
||||
`TransactionalTestExecutionListener` is enabled.
|
||||
|
||||
The following example demonstrates some of the features of `TestTransaction`. See the
|
||||
javadoc for {api-spring-framework}/test/context/transaction/TestTransaction.html[`TestTransaction`]
|
||||
javadoc for {spring-framework-api}/test/context/transaction/TestTransaction.html[`TestTransaction`]
|
||||
for further details.
|
||||
|
||||
[tabs]
|
||||
@@ -355,7 +355,7 @@ of `PlatformTransactionManager` within the test's `ApplicationContext`, you can
|
||||
qualifier by using `@Transactional("myTxMgr")` or `@Transactional(transactionManager =
|
||||
"myTxMgr")`, or `TransactionManagementConfigurer` can be implemented by an
|
||||
`@Configuration` class. Consult the
|
||||
{api-spring-framework}/test/context/transaction/TestContextTransactionUtils.html#retrieveTransactionManager-org.springframework.test.context.TestContext-java.lang.String-[javadoc
|
||||
{spring-framework-api}/test/context/transaction/TestContextTransactionUtils.html#retrieveTransactionManager-org.springframework.test.context.TestContext-java.lang.String-[javadoc
|
||||
for `TestContextTransactionUtils.retrieveTransactionManager()`] for details on the
|
||||
algorithm used to look up a transaction manager in the test's `ApplicationContext`.
|
||||
|
||||
@@ -668,7 +668,7 @@ Kotlin::
|
||||
======
|
||||
|
||||
See
|
||||
https://github.com/spring-projects/spring-framework/blob/main/spring-test/src/test/java/org/springframework/test/context/junit/jupiter/orm/JpaEntityListenerTests.java[JpaEntityListenerTests]
|
||||
{spring-framework-code}/spring-test/src/test/java/org/springframework/test/context/junit/jupiter/orm/JpaEntityListenerTests.java[JpaEntityListenerTests]
|
||||
in the Spring Framework test suite for working examples using all JPA lifecycle callbacks.
|
||||
=====
|
||||
|
||||
|
||||
@@ -112,16 +112,16 @@ categories:
|
||||
The `org.springframework.test.util` package contains several general purpose utilities
|
||||
for use in unit and integration testing.
|
||||
|
||||
{api-spring-framework}/test/util/AopTestUtils.html[`AopTestUtils`] is a collection of
|
||||
{spring-framework-api}/test/util/AopTestUtils.html[`AopTestUtils`] is a collection of
|
||||
AOP-related utility methods. You can use these methods to obtain a reference to the
|
||||
underlying target object hidden behind one or more Spring proxies. For example, if you
|
||||
have configured a bean as a dynamic mock by using a library such as EasyMock or Mockito,
|
||||
and the mock is wrapped in a Spring proxy, you may need direct access to the underlying
|
||||
mock to configure expectations on it and perform verifications. For Spring's core AOP
|
||||
utilities, see {api-spring-framework}/aop/support/AopUtils.html[`AopUtils`] and
|
||||
{api-spring-framework}/aop/framework/AopProxyUtils.html[`AopProxyUtils`].
|
||||
utilities, see {spring-framework-api}/aop/support/AopUtils.html[`AopUtils`] and
|
||||
{spring-framework-api}/aop/framework/AopProxyUtils.html[`AopProxyUtils`].
|
||||
|
||||
{api-spring-framework}/test/util/ReflectionTestUtils.html[`ReflectionTestUtils`] is a
|
||||
{spring-framework-api}/test/util/ReflectionTestUtils.html[`ReflectionTestUtils`] is a
|
||||
collection of reflection-based utility methods. You can use these methods in testing
|
||||
scenarios where you need to change the value of a constant, set a non-`public` field,
|
||||
invoke a non-`public` setter method, or invoke a non-`public` configuration or lifecycle
|
||||
@@ -135,7 +135,7 @@ callback method when testing application code for use cases such as the followin
|
||||
* Use of annotations such as `@PostConstruct` and `@PreDestroy` for lifecycle callback
|
||||
methods.
|
||||
|
||||
{api-spring-framework}/test/util/TestSocketUtils.html[`TestSocketUtils`] is a simple
|
||||
{spring-framework-api}/test/util/TestSocketUtils.html[`TestSocketUtils`] is a simple
|
||||
utility for finding available TCP ports on `localhost` for use in integration testing
|
||||
scenarios.
|
||||
|
||||
@@ -155,7 +155,7 @@ server for the port it is currently using.
|
||||
=== Spring MVC Testing Utilities
|
||||
|
||||
The `org.springframework.test.web` package contains
|
||||
{api-spring-framework}/test/web/ModelAndViewAssert.html[`ModelAndViewAssert`], which you
|
||||
{spring-framework-api}/test/web/ModelAndViewAssert.html[`ModelAndViewAssert`], which you
|
||||
can use in combination with JUnit, TestNG, or any other testing framework for unit tests
|
||||
that deal with Spring MVC `ModelAndView` objects.
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ Kotlin::
|
||||
======
|
||||
|
||||
For Spring MVC, use the following which delegates to the
|
||||
{api-spring-framework}/test/web/servlet/setup/StandaloneMockMvcBuilder.html[StandaloneMockMvcBuilder]
|
||||
{spring-framework-api}/test/web/servlet/setup/StandaloneMockMvcBuilder.html[StandaloneMockMvcBuilder]
|
||||
to load infrastructure equivalent to the xref:web/webmvc/mvc-config.adoc[WebMvc Java config],
|
||||
registers the given controller(s), and creates an instance of
|
||||
xref:testing/spring-mvc-test-framework.adoc[MockMvc] to handle requests:
|
||||
@@ -81,7 +81,7 @@ infrastructure and controller declarations and use it to handle requests via moc
|
||||
and response objects, without a running server.
|
||||
|
||||
For WebFlux, use the following where the Spring `ApplicationContext` is passed to
|
||||
{api-spring-framework}/web/server/adapter/WebHttpHandlerBuilder.html#applicationContext-org.springframework.context.ApplicationContext-[WebHttpHandlerBuilder]
|
||||
{spring-framework-api}/web/server/adapter/WebHttpHandlerBuilder.html#applicationContext-org.springframework.context.ApplicationContext-[WebHttpHandlerBuilder]
|
||||
to create the xref:web/webflux/reactive-spring.adoc#webflux-web-handler-api[WebHandler chain] to handle
|
||||
requests:
|
||||
|
||||
@@ -127,7 +127,7 @@ Kotlin::
|
||||
======
|
||||
|
||||
For Spring MVC, use the following where the Spring `ApplicationContext` is passed to
|
||||
{api-spring-framework}/test/web/servlet/setup/MockMvcBuilders.html#webAppContextSetup-org.springframework.web.context.WebApplicationContext-[MockMvcBuilders.webAppContextSetup]
|
||||
{spring-framework-api}/test/web/servlet/setup/MockMvcBuilders.html#webAppContextSetup-org.springframework.web.context.WebApplicationContext-[MockMvcBuilders.webAppContextSetup]
|
||||
to create a xref:testing/spring-mvc-test-framework.adoc[MockMvc] instance to handle
|
||||
requests:
|
||||
|
||||
@@ -439,7 +439,7 @@ Kotlin::
|
||||
|
||||
TIP: When you need to decode to a target type with generics, look for the overloaded methods
|
||||
that accept
|
||||
{api-spring-framework}/core/ParameterizedTypeReference.html[`ParameterizedTypeReference`]
|
||||
{spring-framework-api}/core/ParameterizedTypeReference.html[`ParameterizedTypeReference`]
|
||||
instead of `Class<T>`.
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user