Use untilThrown instead of untilAsserted with assertThatThrownBy
MSALReplace Awaitility untilAsserted(() -> assertThatThrownBy(...).isInstanceOf(X.class)) with untilThrown(..., X.class), and isExactlyInstanceOf with untilThrownExactly. Both wait until the code throws the expected exception, but the replacement is more direct and returns the exception. Unlike untilAsserted, the replacement fails right away on any other exception unless it is ignored, instead of polling on. untilThrown was added in Awaitility 4.4.0.
org. openrewrite. java. testing. awaitility. AwaitilityUseUntilThrownmod run . --recipe= org. openrewrite. java. testing. awaitility. AwaitilityUseUntilThrownInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.