Skip to content

Add JUnit 4 where the PowerMock JUnit 4 module provided it - #1151

Merged
timtebeek merged 1 commit into
mainfrom
tim/powermock-keep-junit4
Oct 2, 2026
Merged

timtebeek merged 1 commit into
mainfrom
tim/powermock-keep-junit4

Conversation

@timtebeek

Copy link
Copy Markdown
Member

What

RemovePowerMockDependencies now first runs a new AddJUnit4ReplacingPowerMockModule, which adds junit:junit:4.13.2 (test scope / testImplementation) to modules that:

  • depend on powermock-module-junit4*, which brings JUnit 4 in transitively;
  • use org.junit.* types;
  • do not declare JUnit themselves.

Why

In the corpus of open source PowerMock users, otel-launcher-java only had JUnit 4 through powermock-module-junit4. Once the PowerMock dependencies were removed, its tests no longer compiled: package org.junit does not exist, about 170 errors.

Modules without that PowerMock module, and modules that already declare JUnit, are left unchanged, as covered by the new tests.

Corpus check

Mockito1to4Migration:

  • otel-launcher-java now compiles. Its remaining 9 test errors come from mockStatic(System.class), which Disable unsupported PowerMock tests before migrating them #1148 disables instead of migrating. With both changes, the build is green.
  • zip4j, qmq (Maven) and gigya-java-sdk (Gradle) already declare JUnit, so no dependency is added and their results are unchanged.

@timtebeek
timtebeek merged commit 96ed510 into main Oct 2, 2026
1 check passed
@timtebeek
timtebeek deleted the tim/powermock-keep-junit4 branch October 2, 2026 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant