Skip to content

Fix empty setUp/tearDown generation and missing public modifier for JUnit 4#936

Merged
timtebeek merged 2 commits intomainfrom
bmuschko/fix-empty-teardown
Mar 23, 2026
Merged

Fix empty setUp/tearDown generation and missing public modifier for JUnit 4#936
timtebeek merged 2 commits intomainfrom
bmuschko/fix-empty-teardown

Conversation

@bmuschko
Copy link
Contributor

@bmuschko bmuschko commented Mar 22, 2026

Summary

  • Skip generating setUp()/tearDown() methods in PowerMockitoMockStaticToMockito when @PrepareForTest lists classes that have no corresponding mockStatic() invocations
  • Add public modifier to generated @Before/@After methods for JUnit 4, which requires lifecycle methods to be public

…nd missing public modifier for JUnit 4

Skip generating setUp/tearDown methods when @PrepareForTest lists classes
without any corresponding mockStatic() invocations. Also add the public
modifier to generated @Before/@after methods for JUnit 4, which requires
lifecycle methods to be public.
@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Mar 22, 2026
@bmuschko bmuschko added the bug Something isn't working label Mar 22, 2026
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!

@github-project-automation github-project-automation bot moved this from In Progress to Ready to Review in OpenRewrite Mar 23, 2026
@timtebeek timtebeek merged commit f737da5 into main Mar 23, 2026
1 check passed
@timtebeek timtebeek deleted the bmuschko/fix-empty-teardown branch March 23, 2026 08:49
@github-project-automation github-project-automation bot moved this from Ready to Review to Done in OpenRewrite Mar 23, 2026
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.

2 participants