When running the junit 4 to 5 migration recipe, in the assertThrows case checked exceptions are not removed. This results in unused exceptions left in the method signature which are handled by the assertThrows case, and results in intellij warnings.
Any additional context
@timtebeek has mentioned that this could be fixed in a similar way to the issue where unecessary catch blocks exist to catch exceptions not thrown by try blocks, and could be a separate recipe to fix all unecessary checked exceptions:
https://docs.openrewrite.org/recipes/staticanalysis/unnecessarycatch
Here is the code to detect unecessary exceptions:
https://github.com/openrewrite/rewrite-static-analysis/blob/6d04813574c6b02c8bf7d6e2f66b2bdaa881854c/src/main/java/org/openrewrite/staticanalysis/UnnecessaryCatch.java#L79-L94
When running the junit 4 to 5 migration recipe, in the assertThrows case checked exceptions are not removed. This results in unused exceptions left in the method signature which are handled by the assertThrows case, and results in intellij warnings.
Any additional context
@timtebeek has mentioned that this could be fixed in a similar way to the issue where unecessary catch blocks exist to catch exceptions not thrown by try blocks, and could be a separate recipe to fix all unecessary checked exceptions:
https://docs.openrewrite.org/recipes/staticanalysis/unnecessarycatch
Here is the code to detect unecessary exceptions:
https://github.com/openrewrite/rewrite-static-analysis/blob/6d04813574c6b02c8bf7d6e2f66b2bdaa881854c/src/main/java/org/openrewrite/staticanalysis/UnnecessaryCatch.java#L79-L94