Replace PowerMockito doX().when(instance, "method") with Mockito-compatible stubbing
MSALReplaces PowerMockito's doNothing().when(instance, "methodName", args...) stubbing (and that of the other doX() methods) with the standard Mockito pattern doNothing().when(instance).methodName(args...). The method name may be a constant. Stubbing of a static method, doX().when(Type.class, "methodName", args...) or doX().when(Type.class); Type.methodName(args...), becomes PowerMockito.when(Type.class, "methodName", args...).thenX(...) for the static mock, if the file creates one. Mockito can not stub private methods, so stubbing of a private method (or of one of several overloads that include a private one) is left unchanged and gets a comment. Stubbing that can not be resolved to a single accessible method is left unchanged.
org. openrewrite. java. testing. mockito. PowerMockitoDoStubbingToMockitomod run . --recipe= org. openrewrite. java. testing. mockito. PowerMockitoDoStubbingToMockitoInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.