JUnit 4
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
JUnit5
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.9.3</version>
<scope>test</scope>
</dependency>
Spring Boot Test 2.2.0.VERSION,模块升级到JUnit5。
如果需要继续测试之前的JUnit4,添加如下代码
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</exclusion>
</exclusions>
</dependency>
因为hamcrest-core已经包含到hamcrest库中,为避免依赖冲突,移除harcrest-core
junit-vintage-engine
,是JUnit4的测试引擎。
junit-jupiter-engine
,是JUnit5的测试引擎
待更新