如何为Android单元测试配置JUnit 5?
我试过了:
testCompile("org.junit.jupiter:junit-jupiter-api:5.0.0")
但是,当我运行先前最简单的单元测试时,它不起作用:
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
我得到错误:
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:31)
at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:42)
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:36)
at com.intellij.rt.execution.junit.JUnitSt