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

assertThat(anOptional.isPresent()).isTrue() should be converted to assertThat(anOptional).isPresent() #466

Closed
timo-abele opened this issue Jan 18, 2024 · 1 comment · Fixed by #474
Labels
recipe Recipe request

Comments

@timo-abele
Copy link
Contributor

timo-abele commented Jan 18, 2024

What problem are you trying to solve?

In my codebase I have almost every combination of:
assertThat(anOptional.isEmpty()).isFalse()
assertThat(anOptional.isEmpty()).isTrue()
assertThat(anOptional.isPresent()).isFalse()
assertThat(anOptional.isPresent()).isTrue()

Describe the solution you'd like

They should be converted to assertThat(anOptional).isPresent() and assertThat(anOptional).isEmpty().

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 assertThat(anOptional.isPresent()).isTrue() should bre converted to assertThat(anOptional).isPresent() assertThat(anOptional.isPresent()).isTrue() should be converted to assertThat(anOptional).isPresent() Jan 18, 2024
@timtebeek timtebeek added recipe Recipe request and removed enhancement New feature or request labels Jan 18, 2024
@timtebeek timtebeek moved this to Recipes Wanted in OpenRewrite Jan 18, 2024
@timtebeek
Copy link
Contributor

Would be nice additions indeed, thanks for the suggestion!

@timo-abele timo-abele mentioned this issue Feb 6, 2024
3 tasks
@timtebeek timtebeek linked a pull request Feb 6, 2024 that will close this issue
3 tasks
@github-project-automation github-project-automation bot moved this from Recipes Wanted to Done in OpenRewrite Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
recipe Recipe request
Projects
Archived in project
2 participants