Since Magnolia 4.5 we want to use only JUnit4 tests. Most of our existing tests have already been migrated. If you happen to find some JUnit3 tests, you should please convert them.
The bigger part of the conversion can be automated by using the regexps listed beyond. For single test you'll most probably be faster migrating it manually.
- JUnit3 allows setUp & tearDown to be protected - after adding the JUnit4 annotations (@Before, @After) everything will look fine but you'll get an exception at runtime: these must be public in JUnit4
- be sure to convert all subclasses of converted tests - else the sub-tests will compile but most likely not run properly as they will be interpreted to be JUnit4-Tests (failures might be shown as success!)
- indicator for the situation: subclasses show compiler errors on assertX-methods (previously inherited from TestCase, with superclass no longer extending TestCase they are unkown)
Regexps for automated conversion
The following regexps are taken from here, then adapted to fit our needs - no tabs for indention but spaces: