Upgrade mockito-core along with the Mockito that replaces PowerMock

MSAL

Upgrades a declared mockito-core to at least the Mockito 3.x that replaces the PowerMock Mockito API. An older mockito-core would otherwise take precedence over the one mockito-inline depends on, so that Mockito.mockStatic and MockedStatic do not resolve. A declared mockito-inline is upgraded as well, as before 3.4 it depends on a mockito-core without Mockito.mockStatic. This runs after the PowerMock dependencies are replaced, so that it also upgrades the Mockito artifact that replaces them. A version managed by a BOM, such as the Mockito 3.3 of Spring Boot 2.2 and 2.3, is overridden as well, through its mockito.version property where the BOM uses one, so that the other Mockito artifacts it manages stay aligned.

org.openrewrite.java.testing.mockito.UpgradeMockitoCoreReplacingPowerMock
mod run . --recipe=org.openrewrite.java.testing.mockito.UpgradeMockitoCoreReplacingPowerMock

Install 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.

  1. Upgrade Gradle or Maven dependency versions org.mockito:mockito-core:3.x
  2. Upgrade Gradle or Maven dependency versions org.mockito:mockito-inline:3.x