我试图在IntelliJ IDEA 2017.1.5中的同一个项目中使用JUnit4和JUnit5测试.到目前为止,所有测试都基于JUnit4.我加了jupiter,platform并且vintage依赖于我的pom.xml(包括junit-platform-surefire-provider并junit-vintage-engine为保命插件).现在,我的JUnit4的示例测试和JUnit 5的测试都没有执行.
相反,我收到以下错误:
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.