IDEA运行Junit测试报错问题

IDEA运行Junit测试报错问题

Idea运行junit测试用例报错

刚进去公司的小伙伴,第一件事情肯定就是装开发环境,而idea以及自测又是程序员必备的,所以难免遇到奇葩问题;一般环境按照问题,基本和版本有关系,下面就记录一次实战经验,希望能够帮到遇到同样问题的朋友?

错误堆栈如下

/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/bin/java (0x10ed754c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x1106194e0). One of the two will be used. Which one is undefined.
Exception in thread “main” java.lang.NoSuchMethodError: org.junit.platform.commons.util.ReflectionUtils.getDefaultClassLoader()Ljava/lang/ClassLoader;
at
org.junit.platform.launcher.core.ServiceLoaderTestEngineRegistry.loadTestEngines(ServiceLoaderTestEngineRegistry.java:30)
at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:53)
at com.intellij.junit5.JUnit5IdeaTestRunner.createListeners(JUnit5IdeaTestRunner.java:39)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:49)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

Process finished with exit code 1
Empty test suite.

网上搜索找了2个类似的解决方案

我的问题是版本问题,这里再记录一次

主要原因,由于IDEA的版本是2017.1,而运行新的Junit5,版本过低

解决方案:下载IDEA 2017.3.5以上版本,所以干脆下载了2018.3的最新版本,换了版本果然没问题了

参考文献:
https://blog.csdn.net/dietime1943/article/details/82378814

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值