Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JMockit to Mockito Recipe - eq Support, Better Type Propagation, and Error Handling #485

Merged
merged 3 commits into from
Feb 27, 2024

Conversation

tinder-dthomson
Copy link
Contributor

@tinder-dthomson tinder-dthomson commented Feb 27, 2024

What's changed?

This PR includes these major changes:

  • Expectations with raw values mixed with argument matchers should use eq
  • Preserve the type information of Mockito any(Class) invocation arguments
  • Fix infinite loop when rewriting Expectations block fails
  • Major refactor of ArgumentMatchersRewriter to simplify logic and add clarity

What's your motivation?

Continue improving the recipe, make it easier to understand.

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

@tinder-dthomson tinder-dthomson changed the title JMockit to Mockito Recipe - Better Type Propagation and Error Handling JMockit to Mockito Recipe - eq Support, Better Type Propagation, and Error Handling Feb 27, 2024
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions could not be made:

  • src/main/java/org/openrewrite/java/testing/junit5/TempDirNonFinal.java
    • lines 18-22

@timtebeek timtebeek self-requested a review February 27, 2024 09:16
Copy link
Contributor

@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 improvements, thanks! Especially good to see the infinite loop resolved, as that had tripped up one or two users that I know. I also like the more specific eq matchers. Should help folks that want to migrate still.

@timtebeek timtebeek added bug Something isn't working enhancement New feature or request labels Feb 27, 2024
@timtebeek timtebeek merged commit edf0608 into openrewrite:main Feb 27, 2024
2 checks passed
@tinder-dthomson tinder-dthomson deleted the jmockit-to-mockito-types branch February 27, 2024 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants