Replace PowerMockito when(instance, "method", args...) with Mockito.when(instance.method(args...))

MSAL

Replaces PowerMockito's stubbing of a method by name, when(instance, "methodName", args...), with the call of the method itself. A method that returns nothing is stubbed with doAnswer, doThrow or doCallRealMethod instead. Stubbing of a private method, which Mockito can not do, and of a method that can not be resolved to a single one is left unchanged.

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

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.