Migrate JUnit asserts to AssertJ
MSALAssertJ provides a rich set of assertions, truly helpful error messages, improves test code readability. Converts assertions from org.junit.jupiter.api.Assertions to org.assertj.core.api.Assertions. Will convert JUnit 4 to JUnit Jupiter if necessary to match and modify assertions.
org. openrewrite. java. testing. assertj. JUnitToAssertjmod run . --recipe= org. openrewrite. java. testing. assertj. JUnitToAssertjInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.
Recipe list
It runs these recipes, in this order.
- JUnit 5 best practices
- JUnit
assertArrayEqualsto AssertJ - JUnit
assertEqualsto AssertJ - JUnit
assertFalseto AssertJ - JUnit
assertNotEqualsto AssertJ - JUnit
assertNotNullto AssertJ - JUnit
assertNullto AssertJ - JUnit
assertSameto AssertJ - JUnit
assertTrueto AssertJ - JUnit
failto AssertJ - JUnit AssertThrows to AssertJ exceptionType
- Convert try-catch-fail blocks to AssertJ's assertThatThrownBy
- JUnit
assertInstanceOfto AssertJ - Add Gradle or Maven dependency
org.assertj:assertj-core:3.x - Refaster rules that replace JUnit APIs with AssertJ equivalents