openrewrite / rewrite-testing-frameworks

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

Add support for Junit 4 matchers on AssertionsArgumentOrder #637

Closed adambir closed 1 week ago

adambir commented 3 weeks ago

What's changed?

Added support for Junit 4 matchers in the AssertionsArgumentOrder recipe :

What's your motivation?

Junit 5 migration is sometimes complicated so supporting Junit 4 is a plus.

Anything in particular you'd like reviewers to focus on?

Did not add support for assertIterableEquals (does not exist in Junit 4), for assertArrayEquals and assertNull as the signature differs from Junit 5.

Checklist

adambir commented 1 week ago

Hi @timtebeek , thanks for the review.

I reworked the PR to handle the Junit 4 assertion starting with a String message. The message should now stay in first place. As suggested I separated the Junit5 and 4 matchers in the code. Support for assertArrayEquals and assertNull was added.