Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » no public constructor TestCase(String name)
no public constructor TestCase(String name) [message #195931] Thu, 17 February 2005 13:10 Go to next message
Eclipse UserFriend
Since today, I get the following on every test case I run:

junit.framework.AssertionFailedError: Class foo.FooTest 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.runTe sts(RemoteTestRunner.java:474)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:342)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main( RemoteTestRunner.java:194)


I do not use inner test classes. Adding a constructor with the claimed
signature fixes it, but until now I never used such a constructor and it
worked fine. I think I did nothing more than installing and removing php
and haskell plugins since the last test case I ran. Any ideas?

Ingo
Re: no public constructor TestCase(String name) [message #195941 is a reply to message #195931] Thu, 17 February 2005 09:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

A TestCase needs either a public ctor(String) and/or a public ctor(). If
it has neither, then you get this message. My assumption is that
somewhere between the last time you ran tests and this time you added
some other kind of constructor and you did not have an explicit default
ctor. In that case the implicit default ctor would be removed by the
compiler.

--
Thanks,
Rich Kulp
Re: no public constructor TestCase(String name) [message #196081 is a reply to message #195941] Fri, 18 February 2005 14:10 Go to previous messageGo to next message
Eclipse UserFriend
Rich Kulp wrote:
> A TestCase needs either a public ctor(String) and/or a public ctor(). If
> it has neither, then you get this message. My assumption is that
> somewhere between the last time you ran tests and this time you added
> some other kind of constructor and you did not have an explicit default
> ctor. In that case the implicit default ctor would be removed by the
> compiler.
>

Well, I am not talking about *some* test cases. I am talking about *all*
my test cases in my whole workspace in various projects. There are
several hundred of them. They do not all extend a common super test
class except TestCase nor do they all specify an explicit constructor.
Only those with explicit constructors with a single String parameter do
work. Explicit public constructors without pramaters or implicit
constructors do not work anylonger. The following two cases do not work:

public class FooTest extends TestCase {
public void testMethod() throws Exception {}
}

public class FooTest extends TestCase {
public FooTest() {}
public void testMethod() throws Exception {}
}

whereas this one works:

public class FooTest extends TestCase {
public FooTest(String s) {
super(s);
}

public void testMethod() throws Exception {}
}

However, the first cases should work (and at least the first one worked
before). I tend to believe my installation is broken. It sounds strange
to me, that is why I posted my problem here.

Thanks,
Ingo
Re: no public constructor TestCase(String name) [message #196127 is a reply to message #196081] Fri, 18 February 2005 10:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

There is possible something is wrong with your JUnit. When I was using
your stack traces to look at the JUnit code the line numbers didn't
match up with mine. That may be because we are at different levels of
JUnit, or there is something messed up with your JUnit.

My JUnit is org.junit version 3.8.1


--
Thanks,
Rich Kulp
Re: no public constructor TestCase(String name) [message #196307 is a reply to message #196127] Sun, 20 February 2005 13:47 Go to previous message
Eclipse UserFriend
Rich Kulp wrote:
> There is possible something is wrong with your JUnit. When I was using
> your stack traces to look at the JUnit code the line numbers didn't
> match up with mine. That may be because we are at different levels of
> JUnit, or there is something messed up with your JUnit.
>
> My JUnit is org.junit version 3.8.1
>
>

Thanks. It was a junit.jar in jre/lib/ext that was installed along with
some java libs I installed recently. I removed it, and now it works.
Sorry for any inconvenience.

Ingo
Previous Topic:starting a runtime workbench fails with PlugIn Projects (Wizard)
Next Topic:Help - Can't get j2EE libraries to load correctly to compile...servlet not found error!
Goto Forum:
  


Current Time: Sat Jun 21 20:47:47 EDT 2025

Powered by FUDForum. Page generated in 0.06160 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top