Replace MemberModifier.stub and suppress of static methods with Mockito.mockStatic()
MSALReplaces MemberModifier.stub(method(Type.class, "name")).toReturn(..), toThrow(..) and MemberModifier.suppress(method(Type.class, "name")) of a static method with a spy on the static methods of the type, as PowerMockito.spy(Type.class) does, and a stubbing of that one method, which PowerMockitoMockStaticToMockito then migrates to a MockedStatic. Instance methods are left as they are, since Mockito cannot stub a method of every instance of a class.
org. openrewrite. java. testing. mockito. PowerMockMemberModifierToMockitomod run . --recipe= org. openrewrite. java. testing. mockito. PowerMockMemberModifierToMockitoInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.