Migrate JUnit 3 TestCase classes to JUnit 4
MSALConvert test classes that extend junit.framework.TestCase to JUnit 4 annotations: test* methods get @Test, setUp and tearDown get @Before and @After, getName() reads a TestName rule, and the suite() method becomes @BeforeClass/@AfterClass or @RunWith(Suite.class) where it has an equivalent. The TestCase(String) constructor is removed together with the test name its callers pass, across source files. Assertions move to org.junit.Assert. A class that would behave differently under JUnit 4, such as one that overrides run(TestResult), reports to a TestResult, passes its instances around as Tests or needs the test name, is left as it is, and marked with the reason. JUnit 4 keeps running those through its JUnit 3 adapter.
org. openrewrite. java. testing. junit4. MigrateJUnit3TestCasemod run . --recipe= org. openrewrite. java. testing. junit4. MigrateJUnit3TestCaseInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.