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

PowerMockitoMockStaticToMockito should not remove existing mockStatic initializer #612

Merged
merged 2 commits into from
Sep 30, 2024

Conversation

Laurens-W
Copy link
Contributor

@Laurens-W Laurens-W commented Sep 30, 2024

What's changed?

What's your motivation?

Anyone you would like to review specifically?

@timtebeek @knutwannheden

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

@Laurens-W Laurens-W added the bug Something isn't working label Sep 30, 2024
@Laurens-W Laurens-W self-assigned this Sep 30, 2024
@@ -190,7 +190,9 @@ public J visitMethodInvocation(J.MethodInvocation method, ExecutionContext ctx)

if (MOCKED_STATIC_MATCHER.matches(mi)) {
determineTestGroups();
if (!getCursor().getPath(o -> o instanceof J.Assignment || o instanceof J.Try.Resource).hasNext()) {
if (!getCursor().getPath(o -> o instanceof J.VariableDeclarations ||
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Am wondering whether this might be too broad

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.

Indeed best not removed here as well I think, without knowing too much about the wider context.

@timtebeek timtebeek marked this pull request as ready for review September 30, 2024 16:05
@timtebeek
Copy link
Contributor

Lets merge this iteration already; we can iterate further if needed.

@timtebeek timtebeek merged commit cb2af2c into main Sep 30, 2024
2 checks passed
@timtebeek timtebeek deleted the mockstatic-disappears branch September 30, 2024 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Mockito.mockStatic unexpectedly removed in rewrite-testing-frameworks:2.19.0
2 participants