Jacoco does not cover tests using @PrepareForTest(Class.class).
I need to use PowerMockito whenNew method, but it does not work without the PrepareForTest annotation.
Is there any workaround for this issue?
CodePudding user response:
JaCoCo could work in two mods:
- collecting coverage with java agent
- offline instrumentation
If you'd like to collect coverage from PowerMock test then you should use offline instrumentation.
Here working example for Gradle: https://github.com/SurpSG/jacoco-offline-instrumentation