Swap the PowerMock dependencies for Mockito
MSALReplaces and then removes the PowerMock dependencies. Usage that cannot be migrated has been commented out by DisableUnsupportedPowerMockTests, so no code refers to PowerMock by the time this runs. Leaving PowerMock on the classpath is not an option: it registers its own MockMaker, which cannot create the static and construction mocks the migrated tests rely on.
org. openrewrite. java. testing. mockito. RemovePowerMockDependenciesmod run . --recipe= org. openrewrite. java. testing. mockito. RemovePowerMockDependenciesInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.
Recipe list
It runs these recipes, in this order.
- Change
mockito-alltomockito-corealong with the Mockito that replaces PowerMock - Replace PowerMock dependencies with Mockito equivalents
- Upgrade
mockito-corealong with the Mockito that replaces PowerMock - Add JUnit 4 where the PowerMock JUnit 4 module provided it
- Remove a Gradle or Maven dependency
org.powermock:powermock* - Remove Maven managed dependency
org.powermock:powermock* - Exclude a transitive
mockito-allfrom modules that move off PowerMock - Remove unused properties