Collapse a captured exception and its assertThat into assertThatThrownBy

MSAL

Replace an exception captured with JUnit's assertThrows or AssertJ's assertThatExceptionOfType(..).isThrownBy(..).actual(), and only used in the assertThat statement that follows, with a single assertThatThrownBy(..).isInstanceOf(..) chain.

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

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.