【发布时间】:2021-03-29 17:43:25
【问题描述】:
我创建了一个 SPRING BOOT 应用程序版本 2.3.2,当我尝试使用 JUNIT 5 编写单元测试时。STS IDE 中的单元测试类显示 org.junit 未解析。 这是我对 build.gradle 的依赖
dependencies {
compile "org.springframework.boot:spring-boot-starter-actuator:2.3.2.RELEASE"
compile "org.springframework.boot:spring-boot-starter-web:2.3.2.RELEASE"
compile "org.springframework.boot:spring-boot-starter-log4j2:2.3.2.RELEASE"
testCompile "org.springframework.boot:spring-boot-starter-test:2.3.2.RELEASE"
}
测试类:
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
class PasswordvaultComponentTest {
@Test void test()
{
fail("Not yet implemented");
}
}
由于 JUNIT JUPITER 已经捆绑到 SPRING BOOT 2.3.2 中。我不需要在 gradle 中明确提供 Junit Jupiter 依赖项。我在这里缺少任何其他配置吗?非常感谢任何帮助。
【问题讨论】:
标签: spring-boot junit junit5 spring-test