Stop referring to JUnit 5 in documentation
Closes gh-34970
This commit is contained in:
@@ -324,7 +324,7 @@ progresses.
|
||||
== Testing
|
||||
|
||||
This section addresses testing with the combination of Kotlin and Spring Framework.
|
||||
The recommended testing framework is https://junit.org/junit5/[JUnit 5] along with
|
||||
The recommended testing framework is https://junit.org/junit5/[JUnit] along with
|
||||
https://mockk.io/[Mockk] for mocking.
|
||||
|
||||
NOTE: If you are using Spring Boot, see
|
||||
@@ -335,7 +335,7 @@ NOTE: If you are using Spring Boot, see
|
||||
=== Constructor injection
|
||||
|
||||
As described in the xref:testing/testcontext-framework/support-classes.adoc#testcontext-junit-jupiter-di[dedicated section],
|
||||
JUnit Jupiter (JUnit 5) allows constructor injection of beans which is pretty useful with Kotlin
|
||||
JUnit Jupiter allows constructor injection of beans which is pretty useful with Kotlin
|
||||
in order to use `val` instead of `lateinit var`. You can use
|
||||
{spring-framework-api}/test/context/TestConstructor.html[`@TestConstructor(autowireMode = AutowireMode.ALL)`]
|
||||
to enable autowiring for all parameters.
|
||||
@@ -360,7 +360,7 @@ file with a `spring.test.constructor.autowire.mode = all` property.
|
||||
=== `PER_CLASS` Lifecycle
|
||||
|
||||
Kotlin lets you specify meaningful test function names between backticks (```).
|
||||
With JUnit Jupiter (JUnit 5), Kotlin test classes can use the `@TestInstance(TestInstance.Lifecycle.PER_CLASS)`
|
||||
With JUnit Jupiter, Kotlin test classes can use the `@TestInstance(TestInstance.Lifecycle.PER_CLASS)`
|
||||
annotation to enable single instantiation of test classes, which allows the use of `@BeforeAll`
|
||||
and `@AfterAll` annotations on non-static methods, which is a good fit for Kotlin.
|
||||
|
||||
@@ -404,8 +404,8 @@ class IntegrationTests {
|
||||
[[specification-like-tests]]
|
||||
=== Specification-like Tests
|
||||
|
||||
You can create specification-like tests with JUnit 5 and Kotlin.
|
||||
The following example shows how to do so:
|
||||
You can create specification-like tests with Kotlin and JUnit Jupiter's `@Nested` test
|
||||
class support. The following example shows how to do so:
|
||||
|
||||
[source,kotlin,indent=0]
|
||||
----
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
= Spring JUnit Jupiter Testing Annotations
|
||||
|
||||
The following annotations are supported when used in conjunction with the
|
||||
xref:testing/testcontext-framework/support-classes.adoc#testcontext-junit-jupiter-extension[`SpringExtension`] and JUnit Jupiter
|
||||
(that is, the programming model in JUnit 5):
|
||||
xref:testing/testcontext-framework/support-classes.adoc#testcontext-junit-jupiter-extension[`SpringExtension`]
|
||||
and JUnit Jupiter (that is, the programming model in JUnit):
|
||||
|
||||
* xref:testing/annotations/integration-junit-jupiter.adoc#integration-testing-annotations-junit-jupiter-springjunitconfig[`@SpringJUnitConfig`]
|
||||
* xref:testing/annotations/integration-junit-jupiter.adoc#integration-testing-annotations-junit-jupiter-springjunitwebconfig[`@SpringJUnitWebConfig`]
|
||||
|
||||
@@ -140,8 +140,8 @@ Kotlin::
|
||||
======
|
||||
|
||||
If we write tests that use JUnit Jupiter, we can reduce code duplication even further,
|
||||
since annotations in JUnit 5 can also be used as meta-annotations. Consider the following
|
||||
example:
|
||||
since annotations in JUnit Jupiter can also be used as meta-annotations. Consider the
|
||||
following example:
|
||||
|
||||
[tabs]
|
||||
======
|
||||
|
||||
@@ -9,11 +9,11 @@ deal of importance on convention over configuration, with reasonable defaults th
|
||||
can override through annotation-based configuration.
|
||||
|
||||
In addition to generic testing infrastructure, the TestContext framework provides
|
||||
explicit support for JUnit 4, JUnit Jupiter (AKA JUnit 5), and TestNG. For JUnit 4 and
|
||||
TestNG, Spring provides `abstract` support classes. Furthermore, Spring provides a custom
|
||||
JUnit `Runner` and custom JUnit `Rules` for JUnit 4 and a custom `Extension` for JUnit
|
||||
Jupiter that let you write so-called POJO test classes. POJO test classes are not
|
||||
required to extend a particular class hierarchy, such as the `abstract` support classes.
|
||||
explicit support for JUnit Jupiter, JUnit 4, and TestNG. For JUnit 4 and TestNG, Spring
|
||||
provides `abstract` support classes. Furthermore, Spring provides a custom JUnit `Runner`
|
||||
and custom JUnit `Rules` for JUnit 4 and a custom `Extension` for JUnit Jupiter that let
|
||||
you write so-called POJO test classes. POJO test classes are not required to extend a
|
||||
particular class hierarchy, such as the `abstract` support classes.
|
||||
|
||||
The following section provides an overview of the internals of the TestContext framework.
|
||||
If you are interested only in using the framework and are not interested in extending it
|
||||
|
||||
@@ -9,7 +9,7 @@ in JUnit and TestNG.
|
||||
== SpringExtension for JUnit Jupiter
|
||||
|
||||
The Spring TestContext Framework offers full integration with the JUnit Jupiter testing
|
||||
framework, introduced in JUnit 5. By annotating test classes with
|
||||
framework, originally introduced in JUnit 5. By annotating test classes with
|
||||
`@ExtendWith(SpringExtension.class)`, you can implement standard JUnit Jupiter-based unit
|
||||
and integration tests and simultaneously reap the benefits of the TestContext framework,
|
||||
such as support for loading application contexts, dependency injection of test instances,
|
||||
@@ -72,8 +72,8 @@ Kotlin::
|
||||
----
|
||||
======
|
||||
|
||||
Since you can also use annotations in JUnit 5 as meta-annotations, Spring provides the
|
||||
`@SpringJUnitConfig` and `@SpringJUnitWebConfig` composed annotations to simplify the
|
||||
Since you can also use annotations in JUnit Jupiter as meta-annotations, Spring provides
|
||||
the `@SpringJUnitConfig` and `@SpringJUnitWebConfig` composed annotations to simplify the
|
||||
configuration of the test `ApplicationContext` and JUnit Jupiter.
|
||||
|
||||
The following example uses `@SpringJUnitConfig` to reduce the amount of configuration
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2025 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.
|
||||
@@ -55,7 +55,7 @@ import org.springframework.core.annotation.AliasFor;
|
||||
* {@link org.junit.jupiter.api.condition.DisabledOnOs @DisabledOnOs(MAC)} support
|
||||
* in JUnit Jupiter.
|
||||
*
|
||||
* <p>Since JUnit 5.7, JUnit Jupiter also has a condition annotation named
|
||||
* <p>JUnit Jupiter also has a condition annotation named
|
||||
* {@link org.junit.jupiter.api.condition.DisabledIf @DisabledIf}. Thus, if you
|
||||
* wish to use Spring's {@code @DisabledIf} support make sure you import the
|
||||
* annotation type from the correct package.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2025 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.
|
||||
@@ -22,7 +22,7 @@ import org.junit.jupiter.api.extension.ExtensionContext;
|
||||
/**
|
||||
* {@code DisabledIfCondition} is an {@link org.junit.jupiter.api.extension.ExecutionCondition}
|
||||
* that supports the {@link DisabledIf @DisabledIf} annotation when using the <em>Spring
|
||||
* TestContext Framework</em> in conjunction with JUnit 5's <em>Jupiter</em> programming model.
|
||||
* TestContext Framework</em> in conjunction with the JUnit Jupiter testing framework.
|
||||
*
|
||||
* <p>Any attempt to use the {@code DisabledIfCondition} without the presence of
|
||||
* {@link DisabledIf @DisabledIf} will result in an <em>enabled</em>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2025 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.
|
||||
@@ -55,7 +55,7 @@ import org.springframework.core.annotation.AliasFor;
|
||||
* {@link org.junit.jupiter.api.condition.EnabledOnOs @EnabledOnOs(MAC)} support
|
||||
* in JUnit Jupiter.
|
||||
*
|
||||
* <p>Since JUnit 5.7, JUnit Jupiter also has a condition annotation named
|
||||
* <p>JUnit Jupiter also has a condition annotation named
|
||||
* {@link org.junit.jupiter.api.condition.EnabledIf @EnabledIf}. Thus, if you
|
||||
* wish to use Spring's {@code @EnabledIf} support make sure you import the
|
||||
* annotation type from the correct package.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2025 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.
|
||||
@@ -22,7 +22,7 @@ import org.junit.jupiter.api.extension.ExtensionContext;
|
||||
/**
|
||||
* {@code EnabledIfCondition} is an {@link org.junit.jupiter.api.extension.ExecutionCondition}
|
||||
* that supports the {@link EnabledIf @EnabledIf} annotation when using the <em>Spring
|
||||
* TestContext Framework</em> in conjunction with JUnit 5's <em>Jupiter</em> programming model.
|
||||
* TestContext Framework</em> in conjunction with the JUnit Jupiter testing framework.
|
||||
*
|
||||
* <p>Any attempt to use the {@code EnabledIfCondition} without the presence of
|
||||
* {@link EnabledIf @EnabledIf} will result in an <em>enabled</em>
|
||||
|
||||
@@ -65,7 +65,7 @@ import org.springframework.util.ReflectionUtils.MethodFilter;
|
||||
|
||||
/**
|
||||
* {@code SpringExtension} integrates the <em>Spring TestContext Framework</em>
|
||||
* into JUnit 5's <em>Jupiter</em> programming model.
|
||||
* into the JUnit Jupiter testing framework.
|
||||
*
|
||||
* <p>To use this extension, simply annotate a JUnit Jupiter based test class with
|
||||
* {@code @ExtendWith(SpringExtension.class)}, {@code @SpringJUnitConfig}, or
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Core support for integrating the <em>Spring TestContext Framework</em>
|
||||
* with the JUnit Jupiter extension model in JUnit 5.
|
||||
* with the JUnit Jupiter testing framework.
|
||||
*/
|
||||
@NullMarked
|
||||
package org.springframework.test.context.junit.jupiter;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Web support for integrating the <em>Spring TestContext Framework</em>
|
||||
* with the JUnit Jupiter extension model in JUnit 5.
|
||||
* with the JUnit Jupiter extension model.
|
||||
*/
|
||||
@NullMarked
|
||||
package org.springframework.test.context.junit.jupiter.web;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2025 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,7 +24,7 @@ import org.junit.platform.suite.api.Suite;
|
||||
|
||||
/**
|
||||
* JUnit Platform based test suite for tests that involve the Spring TestContext
|
||||
* Framework and JUnit Jupiter (i.e., JUnit 5's programming model).
|
||||
* Framework and JUnit Jupiter.
|
||||
*
|
||||
* <p><strong>This suite is only intended to be used manually within an IDE.</strong>
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user