Refaster rules related to AssertJ assertions over expressions that may throw a Throwable subtype
Recipe ID
tech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipesArtifact
org.openrewrite.recipe:rewrite-third-partyFor 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.
Usage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe tech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipesIf the recipe isn’t available locally, install it with:
mod config recipes jar install org.openrewrite.recipe:rewrite-third-party:0.44.0Definition
This recipe runs the following recipes in order.
- Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOftech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIllegalArgumentExceptionClasstech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfIllegalArgumentExceptionClassRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIllegalArgumentExceptionClassHasMessagetech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfIllegalArgumentExceptionClassHasMessageRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIllegalArgumentExceptionClassRootCauseHasMessagetech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfIllegalArgumentExceptionClassRootCauseHasMessageRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIllegalArgumentExceptionClassHasMessageVarargstech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfIllegalArgumentExceptionClassHasMessageVarargsRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIllegalArgumentExceptionClassHasMessageStartingWithtech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfIllegalArgumentExceptionClassHasMessageStartingWithRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIllegalArgumentExceptionClassHasMessageContainingtech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfIllegalArgumentExceptionClassHasMessageContainingRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIllegalArgumentExceptionClassHasMessageNotContainingAnytech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfIllegalArgumentExceptionClassHasMessageNotContainingAnyRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIllegalStateExceptionClasstech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfIllegalStateExceptionClassRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIllegalStateExceptionClassHasMessagetech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfIllegalStateExceptionClassHasMessageRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIllegalStateExceptionClassRootCauseHasMessagetech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfIllegalStateExceptionClassRootCauseHasMessageRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIllegalStateExceptionClassHasMessageVarargstech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfIllegalStateExceptionClassHasMessageVarargsRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIllegalStateExceptionClassHasMessageStartingWithtech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfIllegalStateExceptionClassHasMessageStartingWithRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIllegalStateExceptionClassHasMessageContainingtech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfIllegalStateExceptionClassHasMessageContainingRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIllegalStateExceptionClassHasMessageNotContainingtech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfIllegalStateExceptionClassHasMessageNotContainingRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfNullPointerExceptionClasstech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfNullPointerExceptionClassRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfNullPointerExceptionClassHasMessagetech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfNullPointerExceptionClassHasMessageRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfNullPointerExceptionClassRootCauseHasMessagetech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfNullPointerExceptionClassRootCauseHasMessageRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfNullPointerExceptionClassHasMessageVarargstech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfNullPointerExceptionClassHasMessageVarargsRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfNullPointerExceptionClassHasMessageStartingWithtech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfNullPointerExceptionClassHasMessageStartingWithRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfNullPointerExceptionClassHasMessageContainingtech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfNullPointerExceptionClassHasMessageContainingRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfNullPointerExceptionClassHasMessageNotContainingtech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfNullPointerExceptionClassHasMessageNotContainingRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIOExceptionClasstech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfIOExceptionClassRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIOExceptionClassHasMessagetech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfIOExceptionClassHasMessageRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIOExceptionClassRootCauseHasMessagetech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfIOExceptionClassRootCauseHasMessageRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIOExceptionClassHasMessageVarargstech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfIOExceptionClassHasMessageVarargsRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIOExceptionClassHasMessageStartingWithtech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfIOExceptionClassHasMessageStartingWithRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIOExceptionClassHasMessageContainingtech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfIOExceptionClassHasMessageContainingRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfIOExceptionClassHasMessageNotContainingtech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfIOExceptionClassHasMessageNotContainingRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByAsInstanceOfThrowabletech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByAsInstanceOfThrowableRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfHasMessagetech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfHasMessageRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfRootCauseHasMessagetech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfRootCauseHasMessageRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfHasMessageVarargstech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfHasMessageVarargsRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfHasMessageStartingWithtech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfHasMessageStartingWithRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfHasMessageContainingtech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfHasMessageContainingRecipe - Refaster template
AssertJThrowingCallableRules.AssertThatThrownByIsInstanceOfHasMessageNotContainingtech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfHasMessageNotContainingRecipe - Refaster template
AssertJThrowingCallableRules.AbstractThrowableAssertHasMessagetech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AbstractThrowableAssertHasMessageRecipe - Refaster template
AssertJThrowingCallableRules.AbstractThrowableAssertWithFailMessagetech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AbstractThrowableAssertWithFailMessageRecipe - Refaster template
AssertJThrowingCallableRules.AbstractThrowableAssertCauseIsSameAstech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AbstractThrowableAssertCauseIsSameAsRecipe
Data tables
Structured output this recipe can produce.
- Source files that had resultsSource files that were modified by the recipe run.
org.openrewrite.table.SourcesFileResults - Source files that had search resultsSearch results that were found during the recipe run.
org.openrewrite.table.SearchResults - Source files that errored on a recipeThe details of all errors produced by a recipe run.
org.openrewrite.table.SourcesFileErrors - Recipe performanceStatistics used in analyzing the performance of recipes.
org.openrewrite.table.RecipeRunStats