Failure in JUnit mode for class com.google.inject.BinderTestSuite$SuccessTest: could not create/run JUnit test suite: cannot retrieve JUnit method #587
There are several of these listed in /core/target/surefire-reports/TestSuite-output.txt
The issue seems to be that the Maven unit testcase processor recognizes these inner classes as JUnit and tries to instantiate them directly (while they are not designed to be invoked directly).
I'm attaching a patch which helps this issue in Eclipse (effectively "hiding" these inner classes), but it does not clear up these messages.
To clear up these messages, empty constructor or testName only constructor needs to be added (possibly refactoring the final variables currently used).
org.testng.TestNGException:
Failure in JUnit mode for class com.google.inject.BinderTestSuite$ConfigurationExceptionTest: could not create/run JUnit test suite:
cannot retrieve JUnit method
at org.testng.junit.JUnitTestRunner.runFailed(JUnitTestRunner.java:231)
at org.testng.junit.JUnitTestRunner.start(JUnitTestRunner.java:224)
at org.testng.junit.JUnitTestRunner.run(JUnitTestRunner.java:205)
at org.testng.TestRunner$2.run(TestRunner.java:559)
at org.testng.TestRunner.runWorkers(TestRunner.java:909)
at org.testng.TestRunner.privateRunJUnit(TestRunner.java:575)
at org.testng.TestRunner.run(TestRunner.java:496)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:332)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:327)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:299)
at org.testng.SuiteRunner.run(SuiteRunner.java:204)
at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:915)
at org.testng.TestNG.runSuitesLocally(TestNG.java:879)
at org.testng.TestNG.run(TestNG.java:787)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:62)
at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:155)
at org.apache.maven.surefire.Surefire.run(Surefire.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021)
org.testng.TestNGException:
Failure in JUnit mode for class com.google.inject.BinderTestSuite$UserExceptionsTest: could not create/run JUnit test suite:
cannot retrieve JUnit method
Failure in JUnit mode for class com.google.inject.internal.util.$MapMakerTestSuite$ReferenceCombinationTestSuite$MapTest: could not create/run JUnit test suite:
cannot retrieve JUnit method
Failure in JUnit mode for class com.google.inject.BinderTestSuite$SuccessTest: could not create/run JUnit test suite:
cannot retrieve JUnit method
Failure in JUnit mode for class com.google.inject.BinderTestSuite$CreationExceptionTest: could not create/run JUnit test suite:
cannot retrieve JUnit method
From gliptak on January 12, 2011 15:52:56
There are several of these listed in /core/target/surefire-reports/TestSuite-output.txt
The issue seems to be that the Maven unit testcase processor recognizes these inner classes as JUnit and tries to instantiate them directly (while they are not designed to be invoked directly).
I'm attaching a patch which helps this issue in Eclipse (effectively "hiding" these inner classes), but it does not clear up these messages.
To clear up these messages, empty constructor or testName only constructor needs to be added (possibly refactoring the final variables currently used).
org.testng.TestNGException: Failure in JUnit mode for class com.google.inject.BinderTestSuite$ConfigurationExceptionTest: could not create/run JUnit test suite: cannot retrieve JUnit method at org.testng.junit.JUnitTestRunner.runFailed(JUnitTestRunner.java:231) at org.testng.junit.JUnitTestRunner.start(JUnitTestRunner.java:224) at org.testng.junit.JUnitTestRunner.run(JUnitTestRunner.java:205) at org.testng.TestRunner$2.run(TestRunner.java:559) at org.testng.TestRunner.runWorkers(TestRunner.java:909) at org.testng.TestRunner.privateRunJUnit(TestRunner.java:575) at org.testng.TestRunner.run(TestRunner.java:496) at org.testng.SuiteRunner.runTest(SuiteRunner.java:332) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:327) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:299) at org.testng.SuiteRunner.run(SuiteRunner.java:204) at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:915) at org.testng.TestNG.runSuitesLocally(TestNG.java:879) at org.testng.TestNG.run(TestNG.java:787) at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:62) at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:155) at org.apache.maven.surefire.Surefire.run(Surefire.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350) at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021) org.testng.TestNGException: Failure in JUnit mode for class com.google.inject.BinderTestSuite$UserExceptionsTest: could not create/run JUnit test suite: cannot retrieve JUnit method Failure in JUnit mode for class com.google.inject.internal.util.$MapMakerTestSuite$ReferenceCombinationTestSuite$MapTest: could not create/run JUnit test suite: cannot retrieve JUnit method Failure in JUnit mode for class com.google.inject.BinderTestSuite$SuccessTest: could not create/run JUnit test suite: cannot retrieve JUnit method Failure in JUnit mode for class com.google.inject.BinderTestSuite$CreationExceptionTest: could not create/run JUnit test suite: cannot retrieve JUnit method
Attachment: gist guice3-surefire.patch
Original issue: http://code.google.com/p/google-guice/issues/detail?id=587