关闭

Junit测试出现异常:Exception in thread "main" java.lang.NoSuchMethodError: org.junit.runner.Description.cre

3076人阅读 评论(0) 收藏 举报
分类:

先来看看错误:


Exception in thread "main" java.lang.NoSuchMethodError: org.junit.runner.Description.createSuiteDescription(Ljava/lang/String;[Ljava/lang/annotation/Annotation;)Lorg/junit/runner/Description;
	at com.intellij.junit4.JUnit4TestListener.testStarted(JUnit4TestListener.java:96)
	at org.junit.runner.notification.RunNotifier$3.notifyListener(RunNotifier.java:83)
	at org.junit.runner.notification.RunNotifier$SafeNotifier.run(RunNotifier.java:37)
	at org.junit.runner.notification.RunNotifier.fireTestStarted(RunNotifier.java:80)
	at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:39)
	at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:75)
	at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:36)
	at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
	at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
	at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:130)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

经过资料查询,发现是junit版本的问题,改成4.11即恢复正常,现在是4.2版本。

运行结果:



0
1

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:126739次
    • 积分:1949
    • 等级:
    • 排名:千里之外
    • 原创:78篇
    • 转载:11篇
    • 译文:0篇
    • 评论:23条
    文章分类
    最新评论