今天在公司写一个测试类,单独调用的时候报错了 ,提示
java.lang.NoSuchMethodError: org.junit.runner.Description.getClassName()Ljava/lang/String;
at org.eclipse.jdt.internal.junit4.runner.DescriptionMatcher$LeadingIdentifierMatcher.matches(DescriptionMatcher.java:95)
at org.eclipse.jdt.internal.junit4.runner.DescriptionMatcher$CompositeMatcher.matches(DescriptionMatcher.java:38)
at org.eclipse.jdt.internal.junit4.runner.SubForestFilter.collectIncludedDescriptions(SubForestFilter.java:49)
at org.eclipse.jdt.internal.junit4.runner.SubForestFilter.apply(SubForestFilter.java:41)
at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:35)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createFilteredTest(JUnit4TestLoader.java:77)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:68)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:43)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
原因是因为可以junit和maven的之间的问题,不能进行当个的方法测试,只能整体的进行测试。