Skip to content

Conversation

amishra-u
Copy link
Contributor

What's changed?

This pr updates the ReplaceInitMockToOpenMock recipe to avoid creating duplicate tearDown methods. Previously, the recipe would unconditionally add a tearDown method, potentially causing conflicts if one already existed in the class. The new logic checks for existing methods named tearDown and appends the next available numeric suffix (e.g., tearDown0, tearDown1, etc.) to ensure method name uniqueness.

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

@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite May 9, 2025
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/resources/META-INF/rewrite/examples.yml
    • lines 2583-2598
    • lines 3392-3391
    • lines 3427-3445

@amishra-u
Copy link
Contributor Author

@timtebeek this one is minor change. Can you please take a look.

Copy link
Member

@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.

Thanks! Not sure how I missed this in notifications, but the travel didn't help. Approved!

@github-project-automation github-project-automation bot moved this from In Progress to Ready to Review in OpenRewrite May 20, 2025
@timtebeek timtebeek merged commit 1a25e21 into openrewrite:main May 20, 2025
1 of 2 checks passed
@github-project-automation github-project-automation bot moved this from Ready to Review to Done in OpenRewrite May 20, 2025
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/resources/META-INF/rewrite/examples.yml
    • lines 1535-1535
    • lines 1817-1817
    • lines 1825-1825
    • lines 2251-2251
    • lines 2265-2265
    • lines 2443-2503
    • lines 2576-2575

@amishra-u amishra-u deleted the duplicate_method branch May 24, 2025 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants