小编jef*_*d.m的帖子

@RunWith 未在 JUnit5 中编译

我的项目是使用 JUnit 5 设置的,我想使用不同的 Runner 进行测试,但我什至无法使用 @RunWith 注释,因为它无法编译。在本指南中,https://www.baeldung.com/junit-5-runwith,它说 RunWith 仍然应该在 JUnit 5 中工作,所以我很困惑为什么它甚至无法编译。
甚至https://junit.org/junit5/docs/current/user-guide/#writing-tests-dependency-injection也有一个使用 RunWith 的示例,如果你向下滚动一点:
Using @RunWith(JUnitPlatform.class) will output all reported entries to stdout.
那为什么我的代码不能编译?我是不是误会了什么?

运行 gradlew 构建:

TestGameController.java:12: error: cannot find symbol
@RunWith(CacioTestRunner.class)
 ^
  symbol: class RunWith
Run Code Online (Sandbox Code Playgroud)

java junit runner

4
推荐指数
1
解决办法
6803
查看次数

标签 统计

java ×1

junit ×1

runner ×1