openrewrite / rewrite-spring

OpenRewrite recipes for Spring projects.
Apache License 2.0
253 stars 73 forks source link

Add recipe to simplify WebTestClient methods #528

Closed FieteO closed 4 months ago

FieteO commented 4 months ago

What's changed?

Introduce a SimplifyWebTestClientCalls recipe that simplifies some invocations of WebTestClient

What's your motivation?

Better readability

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

timtebeek commented 4 months ago

Great to see your progress here; be sure to reach out if you'd like some more help with the final details.

FieteO commented 4 months ago

Sure, I'll continue tomorrow. I think I will come back to you to get some help regarding inspecting the value of the HttpStatus without including that as an import.

I will also need to reconsider the general structure once more status codes need to be rewritten

FieteO commented 4 months ago

Okay, I decided to only deal with the isEqualTo(int) signature in this PR now. The other case of isEqualTo(HttpStatus) is much harder to implement for me and I lack the experience here. This way things are not getting too big and we have something mergeable already.

FieteO commented 4 months ago

@timtebeek I assume the tests are failing due to the added parserClasspath("org.springframework:spring-test:6.+") dependency, right? Shall I push all those updated jars, or how does this normally work?

timtebeek commented 4 months ago

Thanks for the offer, but I'll pick that up from here, as we're also working through this related PR

Just got back from travel so I hope to get this in as soon as I'm caught up. Thanks again for the contribution!