Place AssertJ descriptions and failure messages before the assertion
MSALAssertJ only applies as(..), describedAs(..), withFailMessage(..) and overridingErrorMessage(..) to assertions that run after them, so when they come last in a chain they are silently ignored. This moves them back past the assertions made on the same assert object, to directly after the call that created it, such as assertThat(..) or a navigation like extracting(..). For assertThatThrownBy(..) the check that something was thrown has already run by then, so the moved message only applies to the chained checks such as isInstanceOf(..). Note that a moved withFailMessage(..) or overridingErrorMessage(..) replaces AssertJ's entire failure message, including the expected and actual values.
org. openrewrite. java. testing. assertj. PlaceAssertJDescriptionBeforeAssertionmod run . --recipe= org. openrewrite. java. testing. assertj. PlaceAssertJDescriptionBeforeAssertionInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.