Replace PowerMock Whitebox.invokeMethod() with Java reflection
MSALReplace Whitebox.invokeMethod(Object, String, ..) with java.lang.reflect.Method lookup and invoke(). The method is looked up on the class declaring the unambiguously resolved target method, which also covers Mockito spies and mocks, and its parameter types are taken from that method, falling back to the target's runtime class and each argument's compile-time class. A call nested in a larger expression is replaced by method.invoke(target, ..), with the Method declared before the enclosing statement.
org. openrewrite. java. testing. mockito. PowerMockWhiteboxInvokeMethodToJavaReflectionmod run . --recipe= org. openrewrite. java. testing. mockito. PowerMockWhiteboxInvokeMethodToJavaReflectionInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.