Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert AssertTrue(false) to fail #464

Open
timo-abele opened this issue Jan 18, 2024 · 1 comment
Open

convert AssertTrue(false) to fail #464

timo-abele opened this issue Jan 18, 2024 · 1 comment
Labels
recipe Recipe request

Comments

@timo-abele
Copy link
Contributor

What problem are you trying to solve?

I have in my code some (Junit5) AssertTrue(false, "this shouldn't happen"), because someone didn't use fail when they should have.

Describe the solution you'd like

The Junit5 cleanup recipe should convert such cases to fail("this shouldn't happen").
The AssertJ best pratices recipe might add a similar recipe.

Have you considered any alternatives or workarounds?

Additional context

Are you interested in contributing this feature to OpenRewrite?

no

@timo-abele timo-abele added the enhancement New feature or request label Jan 18, 2024
@timo-abele timo-abele changed the title convert AssertTrue(false) to fail convert AssertTrue(false) to fail Jan 18, 2024
@timtebeek
Copy link
Contributor

Hi @timo-abele ; Yes would fit right in with some of the other AssertTrue migration recipes we already have in
https://github.com/openrewrite/rewrite-testing-frameworks/tree/a426e409ca3b8e04c6470e86cc09d61346e7c0f4/src/main/java/org/openrewrite/java/testing/cleanup

We could even implement this as a Refaster recipe, similar to what we recently added to rewrite-static-analysis in

Given that there's good examples to work from already I'm going to mark this one as good first issue; anyone welcome to pick this up!

@timtebeek timtebeek added recipe Recipe request and removed enhancement New feature or request labels Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
recipe Recipe request
Projects
Status: Recipes Wanted
Development

No branches or pull requests

2 participants