-----Original Message-----
From: Brian Bonner [mailto:brian.bonner@xxxxxxxxxxxx]
Sent: Tuesday, May 17, 2005 2:46 PM
To: users@xxxxxxxxxx
Subject: [cinjug-users] Eclipse - Create an abstract subclass of a class
w/o a default constructor. / running TestCase w/o constructor in Eclipse
Has anyone run into this problem?
I'm trying to use an abstract subclass of a class that doesn't have a
default constructor (TestCase). For some reason, Eclipse complains that
the default constructor with a name is needed to run it in Junit,
however, I can compile the same code at a command line and it works in
JUnit w/o problem.
Here's my code to reproduce the problem: The AbstractTestCase compiles
outside of eclipse and runs in JUnit fine.
/** Abstract Test Case w/ no constructors */
import junit.framework.TestCase;
public abstract class AbstractTestCase extends TestCase {
// Eclipse complains that the Implicit Super Constructor TestCase()
// is not visible for default constructor. Must define an explicit
constructor.
}
Likewise, if I try to use the AbstractTestCase in another TestCase as
shown below, Eclipse complains that there is no default constructor
when I try to run it in JUnit.
/** another test case which uses the abstract Test Case */
public class AnotherTest extends AbstractTestCase {
public AnotherTest(String name){
}
junit.framework.AssertionFailedError: Class AnotherTest has no public
constructor TestCase(String name)
at junit.framework.Assert.fail(Assert.java:51)
at junit.framework.TestSuite$1.runTest(TestSuite.java:225)
at junit.framework.TestCase.runBare(TestCase.java:140)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:131)
at junit.framework.TestSuite.runTest(TestSuite.java:173)
at junit.framework.TestSuite.run(TestSuite.java:168)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTest
Runner.java:436)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunne
r.java:311)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunn
er.java:192)
AnotherTest *can't* have a constructor of TestCase(String name), because
AbstractTestCase suppressed it.
Any thoughts?
--
Brian
---------
You may unsubscribe from this mailing list
by sending a blank email addressed to:
users-unsubscribe@xxxxxxxxxx
--
Find additional help by sending a blank email
addressed to:
users-help@xxxxxxxxxx