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

Add more simplifications #474

Merged
merged 10 commits into from
Feb 6, 2024
Merged

Add more simplifications #474

merged 10 commits into from
Feb 6, 2024

Conversation

timo-abele
Copy link
Contributor

@timo-abele timo-abele commented Feb 6, 2024

What's changed?

New AssertJ simplifications:

Before After
assertThat(anOptional.isEmpty()).isFalse() assertThat(anOptional).isNotEmpty()
assertThat(anOptional.isEmpty()).isTrue() assertThat(anOptional).isEmpty()
assertThat(anOptional.isPresent()).isFalse() assertThat(anOptional).isNotPresent()
assertThat(aString.contains("foo")).isFalse() assertThat(aString).doesNotContain("foo")
assertThat(aMap.isEmpty()).isTrue() assertThat(aMap).isEmpty()
assertThat(aMap.isEmpty()).isFalse() assertThat(aMap).isNotEmpty()

(assertThat(anOptional.isPresent()).isTrue() is already covered)

What's your motivation?

closing #466 + adding additional transformations

Anything in particular you'd like reviewers to focus on?

Anyone you would like to review specifically?

Have you considered any alternatives or workarounds?

Any additional context

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

Copy link
Contributor

@timtebeek timtebeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great addition @timo-abele; thanks a lot!

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@timtebeek timtebeek merged commit 8fd34dd into openrewrite:main Feb 6, 2024
2 checks passed
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
Development

Successfully merging this pull request may close these issues.

assertThat(anOptional.isPresent()).isTrue() should be converted to assertThat(anOptional).isPresent()
2 participants