Skip to content

Override a Spring Boot BOM-managed Mockito when replacing PowerMock - #1186

Merged
timtebeek merged 1 commit into
mainfrom
tim/mockito-managed-version-upgrade
Oct 12, 2026
Merged

timtebeek merged 1 commit into
mainfrom
tim/mockito-managed-version-upgrade

Conversation

@timtebeek

Copy link
Copy Markdown
Member

Under a Spring Boot 2.2–2.3 parent, ReplacePowerMockito left Mockito at the BOM-managed 3.3.3, so MockedStatic and MockedConstruction did not resolve. UpgradeMockitoCoreReplacingPowerMock now sets overrideManagedVersion: true, which overrides the BOM's mockito.version property so the whole Mockito family moves to 3.12.4, and runs after ReplacePowerMockDependencies so it also upgrades the mockito-inline added without a version. The mockito-all to mockito-core rename moves into a new ChangeMockitoAllToMockitoCoreReplacingPowerMock that still runs first, so no second mockito-core gets added. New tests cover the Boot 2.3.12 parent with and without a local <mockito.version> and assert the resolved versions on the MavenResolutionResult marker. A <mockito.version> set in a local multi-module parent is still not raised, and UpgradeTransitiveDependencyVersion is left out because its downgrade guard only looks at compile scope, so it pins a test-scoped Mockito 5 down to 3.x.

@timtebeek
timtebeek merged commit aad2de1 into main Oct 12, 2026
1 check passed
@timtebeek
timtebeek deleted the tim/mockito-managed-version-upgrade branch October 12, 2026 16:29
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite Oct 12, 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