rewrite-testing-frameworks icon indicating copy to clipboard operation
rewrite-testing-frameworks copied to clipboard

convert `.hasSize(list2.size())` into `.hasSameSizeAs(list2)`

Open timo-abele opened this issue 1 year ago • 1 comments

What problem are you trying to solve?

I have many instances of AssertJ assertThat(list).hasSize(list2.size()) in my code.

Describe the solution you'd like

The AssertJ best practices recipe should convert them to assertThat(list).hasSameSizeAs(list2).

Have you considered any alternatives or workarounds?

Additional context

Are you interested in contributing this feature to OpenRewrite?

no

timo-abele avatar Jan 18 '24 17:01 timo-abele

Seems reasonable indeed; would be a nice addition to the recipe catalog.

timtebeek avatar Jan 18 '24 18:01 timtebeek