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

Simplify toString assertion #554

Merged
merged 3 commits into from
Jul 24, 2024
Merged

Simplify toString assertion #554

merged 3 commits into from
Jul 24, 2024

Conversation

velo
Copy link
Contributor

@velo velo commented Jul 24, 2024

Instead of using:

assertThat(cat.toString()).isEqualTo("animal");

Could use:

assertThat(cat).hasToString("animal");

What's changed?

What's your motivation?

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

Instead of using:
```
assertThat(cat.toString()).isEqualTo("animal");
```

Could use:
```
assertThat(cat).hasToString("animal");
```

Signed-off-by: Marvin Froeder <velo.br@gmail.com>
@timtebeek timtebeek added the recipe Recipe request label Jul 24, 2024
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.

Nice addition, thanks! Love how you keep turning up with more of these replacements, and how easy they've become to add and improve tests suites.

@timtebeek timtebeek merged commit c2e4fba into openrewrite:main Jul 24, 2024
2 checks passed
@velo
Copy link
Contributor Author

velo commented Jul 24, 2024

Nice addition, thanks! Love how you keep turning up with more of these replacements, and how easy they've become to add and improve tests suites.

You never know when one of these might land me a role at open rewrite.

And I used it a lot on my day job

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.

2 participants