Refaster rules related to AssertJ assertions over expressions that may throw a Throwable subtype

Apache 2.0

For reasons of consistency we prefer org.assertj.core.api.Assertions#assertThatThrownBy over static methods for specific exception types. Note that only the most common assertion expressions are rewritten here; covering all cases would require the implementation of an Error Prone check instead. Source.

tech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes
mod run . --recipe=tech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes

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. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOf
  2. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIllegalArgumentExceptionClass
  3. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIllegalArgumentExceptionClassHasMessage
  4. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIllegalArgumentExceptionClassRootCauseHasMessage
  5. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIllegalArgumentExceptionClassHasMessageVarargs
  6. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIllegalArgumentExceptionClassHasMessageStartingWith
  7. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIllegalArgumentExceptionClassHasMessageContaining
  8. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIllegalArgumentExceptionClassHasMessageNotContainingAny
  9. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIllegalStateExceptionClass
  10. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIllegalStateExceptionClassHasMessage
  11. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIllegalStateExceptionClassRootCauseHasMessage
  12. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIllegalStateExceptionClassHasMessageVarargs
  13. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIllegalStateExceptionClassHasMessageStartingWith
  14. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIllegalStateExceptionClassHasMessageContaining
  15. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIllegalStateExceptionClassHasMessageNotContaining
  16. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfNullPointerExceptionClass
  17. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfNullPointerExceptionClassHasMessage
  18. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfNullPointerExceptionClassRootCauseHasMessage
  19. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfNullPointerExceptionClassHasMessageVarargs
  20. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfNullPointerExceptionClassHasMessageStartingWith
  21. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfNullPointerExceptionClassHasMessageContaining
  22. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfNullPointerExceptionClassHasMessageNotContaining
  23. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIOExceptionClass
  24. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIOExceptionClassHasMessage
  25. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIOExceptionClassRootCauseHasMessage
  26. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIOExceptionClassHasMessageVarargs
  27. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIOExceptionClassHasMessageStartingWith
  28. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIOExceptionClassHasMessageContaining
  29. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIOExceptionClassHasMessageNotContaining
  30. Refaster template AssertJThrowingCallableRules.AssertThatThrownByAsInstanceOfThrowable
  31. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfHasMessage
  32. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfRootCauseHasMessage
  33. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfHasMessageVarargs
  34. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfHasMessageStartingWith
  35. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfHasMessageContaining
  36. Refaster template AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfHasMessageNotContaining
  37. Refaster template AssertJThrowingCallableRules.AbstractThrowableAssertHasMessage
  38. Refaster template AssertJThrowingCallableRules.AbstractThrowableAssertWithFailMessage
  39. Refaster template AssertJThrowingCallableRules.AbstractThrowableAssertCauseIsSameAs