A large number of my junit tests are failing with errors like this:

junit.framework.AssertionFailedError: Class
uk.co.orchardsystems.edr.importexport.exporttests.EntityScreenExportTest has
no public constructor TestCase(String name)

These test classes run successfully from both Ant and within Eclipse, but
fail when run from Gradle.

The test classes don't have any constructors and extend from
org.springframework.test.jpa.AbstractJpaTests (which ultimately extends
junit.framework.TestCase).

Our classes use Junit 4 annotations such as @Test around the test methods
(although the Spring classes we are extending may be Junit 3 ???).

Other reports of this issue were caused by inner classes, but we don't have
any in our tests.
Is there a way to specify to run the tests as Junit 4 (to see if the problem
is caused because the test is executed as a Junit 3 test?)

If I add a constructor (with a String argument) the test still fails but
with this error:
org.springframework.beans.BeanInstantiationException: Could not instantiate
bean class
[uk.co.orchardsystems.edr.importexport.exporttests.EntityScreenExportTest]:
No default constructor found; nested exception is
java.lang.NoSuchMethodException:
uk.co.orchardsystems.edr.importexport.exporttests.EntityScreenExportTest.<init>()

If I add a default constructor also, the test fails with:

junit.framework.AssertionFailedError: TestCase.getName() cannot be null

-- 
View this message in context: 
http://gradle.1045684.n5.nabble.com/Junit-tests-fail-junit-framework-AssertionFailedError-has-no-public-constructor-tp3202811p3202811.html
Sent from the gradle-user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to