Reputation: 2054
We have a lot of old unit tests which were written with Junit 3.x. I am tasked with porting them to our JUnit 4.x coding standard, which among things, forbids the use of "extends TestCase".
Some of the old tests have a call to super.setUp() which I need to now remove, however, I am not sure what is happening in that call. Can I just delete this line of code without worrying or should I replace it with something?
Upvotes: 2
Views: 120
Reputation: 12266
super.setUp() is TestCase doesn't do anything and can be safely removed. You still need to keep the super.setUp() call if you are extending another class. However that one won't fail to compile, so you should be ok.
For example, suppose we have ATest extends BTest and BTest extends TestCase. You can safely remove the super.setUp() call from BTest and not ATest. Since the BTest one might do something, ATest still needs to call it.
Upvotes: 0
Reputation: 3166
Comment out the line and then run the test. If the test was written right the test result should give you the answer assuming the test was succeeding previously.
Upvotes: 0
Reputation: 14738
Since setUp() is now called before each test, you can safely remove super.setUp().
Upvotes: 2