Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does JUnit have some weird 30 character length limit on the name of your class?

I have a class that I made for some unit tests. Everything was going swimmingly until I changed the name of the class to match the class that I was testing suffixed with TestCase. All of a sudden every time I tried to run the test case in Eclipse I get a "There is no input configuration for this type".

Someone then suggested that there is a 30 character length limit on the name of the class. I had a look at the class name and it was 32 characters long. I then deleted two characters off the end and tried again and everything worked. I put them back and it stopped working.

Is there an explanation for this?

EDIT:

In response to some of the comments. It is Galileo, using Windows XP, JUnit 4.4.

EDIT 2:

Sorry guys. I guess I was wrong. The pattern seems to be that JUnit/Eclipse does not like my class name being TestCase. As soon as I take the TestCase part away it works. It works with a massively long string, short strings and everything in between. The name can be anything like ABCTestCase it just CANNOT be for some reason TestCase.

like image 530
uriDium Avatar asked Dec 31 '25 16:12

uriDium


2 Answers

By default I believe the JUnit runners are set to look for *Test files, so it will filter out TestCase. People often use *TestCase as a base class without any tests of its own. Not sure if that's what you're running into. If so, it's configurable in the runner.

like image 123
ndp Avatar answered Jan 03 '26 05:01

ndp


Turns out that it was because I was extending TestCase which makes the JUnit runner think it is still version 3. Even if you tell it to use version 4.

like image 20
uriDium Avatar answered Jan 03 '26 06:01

uriDium



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!