openrewrite / rewrite-testing-frameworks

OpenRewrite recipes that perform common Java testing migration tasks.
Apache License 2.0
77 stars 73 forks source link

Simplify toString assertion #554

Closed velo closed 4 months ago

velo commented 4 months ago

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

velo commented 4 months ago

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