HoppeJ / crap4j

Automatically exported from code.google.com/p/crap4j
0 stars 0 forks source link

Inner classes in test are considered to be test cases #16

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create test containing inner class
2. build project, run crap4j
3. tests will fail for inner classes (that are not tests at all)

What is the expected output? What do you see instead?
Runner should ignore inner classes, but I am getting following error:

  <testcase classname="junit.framework.JUnit4TestCaseFacade" name="unknown"
time="0.0">
    <error message="Test class should have public zero-argument
constructor" type="java.lang.Exception">java.lang.Exception: Test class
should have public zero-argument constructor
    at
org.junit.internal.runners.MethodValidator.validateNoArgConstructor(MethodValida
tor.java:54)
    at
org.junit.internal.runners.MethodValidator.validateMethodsForDefaultRunner(Metho
dValidator.java:39)
    at
org.junit.internal.runners.TestClassRunner.validate(TestClassRunner.java:33)
    at
org.junit.internal.runners.TestClassRunner.&lt;init&gt;(TestClassRunner.java:27)
    at
org.junit.internal.runners.TestClassRunner.&lt;init&gt;(TestClassRunner.java:20)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at org.junit.internal.requests.ClassRequest.buildRunner(ClassRequest.java:33)
    at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:28)
    at junit.framework.JUnit4TestAdapter.&lt;init&gt;(JUnit4TestAdapter.java:24)
    at junit.framework.JUnit4TestAdapter.&lt;init&gt;(JUnit4TestAdapter.java:17)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at
com.agitar.junit.runner.SuperRunnerTestRunner.run(SuperRunnerTestRunner.java:409
)
    at
com.agitar.junit.runner.SuperRunnerTestRunner.launch(SuperRunnerTestRunner.java:
948)
    at
com.agitar.junit.runner.SuperRunnerTestRunner.main(SuperRunnerTestRunner.java:82
2)
Caused by: java.lang.NoSuchMethodException:
sk.kadeco.craptest.TestMyCrap$FakeCollaborator.&lt;init&gt;()
    at java.lang.Class.getConstructor0(Class.java:2706)
    at java.lang.Class.getConstructor(Class.java:1657)
    at
org.junit.internal.runners.MethodValidator.validateNoArgConstructor(MethodValida
tor.java:52)
    ... 19 more
</error>

What version of the product are you using? On what operating system?
1.1.6, windows, java 1.6, junit 4.3.1

Please provide any additional information below.

Original issue reported on code.google.com by palob...@googlemail.com on 22 May 2009 at 3:48