play1
play1 copied to clipboard
PowerMock support
I try to test with PowerMock with these dependencies:
- org.mockito -> mockito-core 2.23.4
- org.powermock -> powermock-module-junit4 1.7.4
- org.powermock -> powermock-core 1.7.4
- org.powermock -> powermock-api-mockito2 1.7.4
and this code:
@RunWith(PowerMockRunner.class)
public class ContextProcessorUtilsTest extends UnitTest{
@Test
@PrepareOnlyThisForTest(ContextProcessorUtils.class)
public void getSessionTriggers() {
PowerMockito.mockStatic(ContextProcessorUtils.class);
}
}
and this:
@RunWith(PowerMockRunner.class)
@PrepareForTest(ContextProcessorUtils.class)
public class ContextProcessorUtilsTest extends UnitTest{
@Test
public void getSessionTriggers() {
PowerMockito.mockStatic(ContextProcessorUtils.class);
}
}
and the error: A java.lang.ClassNotFoundException has been caught, utils.ContextProcessorUtilsTest
@JorgeJOcampo Can you share the full stack trace?
P.S. Using PowerMock is a bad practice (in my opinion). Prefer to avoid using static methods in your code.