jupiter 依赖_导入org.junit.jupiter无法解析

bd96500e110b49cbb3cd949968f18be7.png

Hey its the first time i use JUnit with Java and i'm not sure how to set it up inside Visual studio Code. I tried to put Junit-4.13.jar inside my a lib file in the root directory but nothing changed. any ideas? I am on MacOS.

006Vw.png

MvVSE.png

lQmYc.png

L4Ua6.png

解决方案

There were 2 main issues with this configuration:

JUnit 4 dependency jar was used while in the source code imports from JUnit 5 API were used

Tests resided in the same location as sources, while the dependencies defined via Gradle/Maven for tests limit the scope to src/test/java roots.

In a non-Gradle project the issue was fixed by adding the proper JUnit 5 dependencies to the module.

In the Gradle project the issue was fixed by moving the test class from src/main/java to src/test/java.

Sample Gradle project is available on GitHub.

More details about using JUnit 5 can be found in the official documentation.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值