Skip to content

Bump wiremock-core parser classpath and keep the class prefix when removing PowerMock runners - #1201

Merged
timtebeek merged 2 commits into
mainfrom
bump-wiremock-core-parser-classpath
Oct 19, 2026
Merged

timtebeek merged 2 commits into
mainfrom
bump-wiremock-core-parser-classpath

Conversation

@timtebeek

@timtebeek timtebeek commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

What's changed

WireMock 4 parser classpath

Bumps the pinned WireMock 4 parser classpath entry to the newest beta. That is the same version the wiremock4.yml migration already upgrades to.

Configuration Artifact Before After
parserClasspath org.wiremock:wiremock-core 4.0.0-beta.38 4.0.0-beta.40

The version stays pinned. There is no 4.0.0 GA yet, and since rewrite-build-gradle-plugin 2.27.2 dynamic versions no longer resolve to pre-releases, so 4.+ would match nothing. A trailing comment on the pin now says so.

The classpathFromResources names don't include a version (wiremock-core-4), so no recipe or test code needs to change.

I regenerated the type table with ./gradlew --refresh-dependencies createTypeTable using rewrite-build-gradle-plugin 2.27.2. The only GAV change is wiremock-core 4.0.0-beta.38 → 4.0.0-beta.40.

Blank line left when removing @RunWith(PowerMockRunner.class)

Three tests in ReplacePowerMockitoIntegrationTest failed on main with an extra blank line before the class (mockingInheritedStaticMethodIsDisabled, mockingStaticMethodsOfSystemIsDisabled, thatPowerMockitoIsReplacedInTestNGTests).

PowerMockRunnerDelegateToRunWith dropped @RunWith(PowerMockRunner.class) from the class's annotation list without moving its prefix along, so the next annotation kept its own leading newline. Since openrewrite/rewrite#9253, RemoveAnnotationVisitor hands the first removed annotation's prefix to whatever follows it. So when @PrepareForTest was removed afterwards, that stray newline ended up before the class and added a blank line.

The recipe now removes both @RunWith(PowerMockRunner.class) and @PowerMockRunnerDelegate through RemoveAnnotationVisitor, which keeps the class prefix intact. PowerMockRunnerDelegateToRunWithTest.removesRunWithPowerMockRunnerWithoutDelegate had the old double blank line written into its expected output, so it now expects a single blank line.

Testing

  • All 108 tests in org.openrewrite.java.testing.wiremock pass.
  • All 459 tests in org.openrewrite.java.testing.mockito pass (2 skipped).

@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Oct 19, 2026
@timtebeek timtebeek moved this from In Progress to Ready to Review in OpenRewrite Oct 19, 2026
@timtebeek timtebeek changed the title Bump wiremock-core parser classpath to 4.0.0-beta.40 Bump wiremock-core parser classpath and keep the class prefix when removing PowerMock runners Oct 19, 2026
@timtebeek
timtebeek merged commit 143951e into main Oct 19, 2026
2 checks passed
@timtebeek
timtebeek deleted the bump-wiremock-core-parser-classpath branch October 19, 2026 16:51
@github-project-automation github-project-automation Bot moved this from Ready to Review to Done in OpenRewrite Oct 19, 2026
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.

1 participant