Replace PowerMock Whitebox.getInternalState() with Java reflection
MSALReplace Whitebox.getInternalState(Object, String) with java.lang.reflect.Field access, casting to the declared result type where needed. The field is looked up on the class declaring it, found through the target's declared type and its superclasses, which also covers Mockito spies and mocks; when that class cannot be determined, the target's runtime class is used. A call nested in a larger expression is replaced by field.get(target), with the Field declared before the enclosing statement.
org. openrewrite. java. testing. mockito. PowerMockWhiteboxGetInternalStateToJavaReflectionmod run . --recipe= org. openrewrite. java. testing. mockito. PowerMockWhiteboxGetInternalStateToJavaReflectionInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.