Skip to content

Conversation

sullis
Copy link
Contributor

@sullis sullis commented Sep 4, 2025

What's changed?

improve test cases in TestsShouldNotBePublicTest

What's your motivation?

more test coverage

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 Sep 4, 2025
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.

Hi @sullis ; thanks for the offer to help. In this case I'm not sure it's a clear improvement. We try to keep our unit tests as minimal as possible for the scenario they are testing, and in this case it doesn't make a difference whether the parent class is abstract or not, as it's the methods that we visit either way. The original test method already covers both sides of this conditional:

if (m.hasModifier(J.Modifier.Type.Abstract) || TypeUtils.isOverride(method.getMethodType())) {
return m;
}

I'm afraid the added elements here distract from what we're testing, and might complicate stepping through with a debugger since there's more "skips" and mental parsing needed to figure out exactly what's asserted here. Because of that I'm leaning towards closing this PR for now.

Did you see or expect any issues that prompted you to add these additional elements?

@timtebeek timtebeek added the question Further information is requested label Sep 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants