Replace PowerMock Whitebox with Java reflection

MSAL

Replace org.powermock.reflect.Whitebox calls (setInternalState, getInternalState, invokeMethod, getField, getMethod, invokeConstructor) with plain Java reflection using java.lang.reflect.Field, java.lang.reflect.Method, and java.lang.reflect.Constructor.

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

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

Recipe list

It runs these recipes, in this order.

  1. Replace PowerMock Whitebox.setInternalState() with Java reflection
  2. Replace PowerMock Whitebox.getInternalState() with Java reflection
  3. Replace PowerMock Whitebox.invokeMethod() with Java reflection
  4. Replace PowerMock Whitebox.getField() with Java reflection
  5. Replace PowerMock Whitebox.getMethod() with Java reflection
  6. Replace PowerMock Whitebox.invokeConstructor() with Java reflection