Migrate AssertionsForClassTypes and AssertionsForInterfaceTypes to Assertions

MSAL

AssertJ deprecated AssertionsForClassTypes and AssertionsForInterfaceTypes in favor of the unified Assertions entry point. This recipe retargets their static methods to Assertions, using assertThatObject where a plain assertThat would otherwise re-bind to a more specific overload and stop compiling (see https://github.com/openrewrite/rewrite-testing-frameworks/issues/664).

org.openrewrite.java.testing.assertj.MigrateAssertionsForClassAndInterfaceTypes
mod run . --recipe=org.openrewrite.java.testing.assertj.MigrateAssertionsForClassAndInterfaceTypes

Install 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.

  1. Use Assertions.assertThatObject for ambiguous AssertionsForClassTypes.assertThat calls
  2. Change method target to static
  3. Change method target to static