今天在測試時 JUnit時出現該錯誤,百度了好多方法,大部分說是忘記寫@Test,仔細檢查了下發現我寫了,代碼也沒錯,想了下是否是版本的問題,結果發現別的方法還能測java
錯誤緣由以下:eclipse
CurrentSessionTest.test31
initializationError(org.junit.runner.manipulation.Filter)
java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=test31], {ExactMatcher:fDisplayName=test31(com.zy.currentSession.CurrentSessionTest)], {LeadingIdentifierMatcher:fClassName=com.zy.currentSession.CurrentSessionTest,fLeadingIdentifier=test31]] from org.junit.internal.requests.ClassRequest@45ff54e6測試
at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:40)spa
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createFilteredTest(JUnit4TestLoader.java:77)ip
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:68)get
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:43)requests
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)it
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)io
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)test
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
最後,無心間發現應該是: public void test4()
寫成了 : private void test4()