Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
81af0f2f
Commit
81af0f2f
authored
May 09, 2019
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explicitly include JUnit 4 in test starter
Closes gh-16807
parent
7e118a02
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
4 deletions
+35
-4
spring-boot-features.adoc
...ing-boot-docs/src/main/asciidoc/spring-boot-features.adoc
+27
-4
pom.xml
...ect/spring-boot-starters/spring-boot-starter-test/pom.xml
+4
-0
pom.xml
spring-boot-samples/spring-boot-sample-junit-jupiter/pom.xml
+4
-0
No files found.
spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
View file @
81af0f2f
...
...
@@ -6812,9 +6812,31 @@ Most developers use the `spring-boot-starter-test` "`Starter`", which imports bo
Boot test modules as well as JUnit Jupiter, AssertJ, Hamcrest, and a number of other
useful libraries.
TIP: The starter brings also the vintage engine so that you can run both JUnit 4 and Junit
5 tests. If you have migrated your tests to JUnit 5, consider excluding the vintage
engine.
[TIP]
====
The starter also brings the vintage engine and `junit:junit` so that you can run both
JUnit 4 and Junit 5 tests. If you have migrated your tests to JUnit 5, you should
exclude JUnit 4 support, as shown in the following example:
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
----
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
----
====
...
...
@@ -8891,7 +8913,8 @@ makes it possible to use `@BeforeClass` and `@AfterClass` annotations on non-sta
methods, which is a good fit for Kotlin.
JUnit 5 is the default and the vintage engine is provided for backward compatibility with
JUnit 4. If you don't use it, exclude `org.junit.vintange:junit-vintage-engine`. See the
JUnit 4. If you don't use it, exclude `org.junit.vintange:junit-vintage-engine` and
`junit:junit`. See the
{junit5-documentation}/#dependency-metadata-junit-jupiter-samples[JUnit 5 documentation]
for more details. You also need to
{junit5-documentation}/#writing-tests-test-instance-lifecycle-changing-default[switch test
...
...
spring-boot-project/spring-boot-starters/spring-boot-starter-test/pom.xml
View file @
81af0f2f
...
...
@@ -43,6 +43,10 @@
<groupId>
org.junit.vintage
</groupId>
<artifactId>
junit-vintage-engine
</artifactId>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
</dependency>
<dependency>
<groupId>
org.mockito
</groupId>
<artifactId>
mockito-junit-jupiter
</artifactId>
...
...
spring-boot-samples/spring-boot-sample-junit-jupiter/pom.xml
View file @
81af0f2f
...
...
@@ -28,6 +28,10 @@
<groupId>
org.junit.vintage
</groupId>
<artifactId>
junit-vintage-engine
</artifactId>
</exclusion>
<exclusion>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment