Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Simplify toString assertion#554

Merged
timtebeek merged 3 commits intoopenrewrite:mainfrom
velo:patch-1
Jul 24, 2024
Merged

Simplify toString assertion#554
timtebeek merged 3 commits intoopenrewrite:mainfrom
velo:patch-1

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 <[email protected]>
@timtebeek timtebeek added the recipe Recipe request label Jul 24, 2024
Copy link
Member

@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
@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