Top "Powermock" questions

Use this tag for questions about PowerMock, a Java library for creating mock objects for classes and methods.

Mocking static methods with PowerMock and Mockito

I'm trying to verify a call to java.sql.DriverManager.getConnection using JUnit, Mockito, and PowerMock. Here's my test case: @…

java unit-testing junit mockito powermock
Extension API internal error: org.powermock.api.extension.reporter.MockingFrameworkReporterFactoryImpl

I'm trying to write a unit test using PowerMockRunner but I got the following error: java.lang.IllegalStateException: Extension API …

java eclipse junit powermock powermockito
Jacoco maven plugin clogs up console with Exceptions-java.lang.IllegalStateException: class is already instrumented

I am working on sonar code coverage using Jacoco plugin and using power mock mockito combination to write JUnit test …

java powermock instrumentation jacoco-maven-plugin
mocks - how to verify private method was called

I am trying to mock a private method and verify it has been executed. The mocking itself works fine, that …

java junit powermock private-methods
PowerMock and Java 8 issue: InterfaceMethodrefInfo cannot be cast to MethodrefInfo

I´m having issues while trying to execute a unit test using PowerMock with Mockito. I need PowerMockito to mock …

java powermock javassist
Replacing PowerMock's @PrepareForTest programmatically?

I am using PowerMock to mock static methods in junit tests, typically done as follows: @RunWith(PowerMockRunner.class) @PrepareForTest({Foo.…

unit-testing junit powermock
PowerMock: stub methods from parent class

I'm using PowerMock and I'd like to know how to keep all behavior of the child class, but stub super …

java overriding powermock super stub
Cannot run powermockrule with SpringJUnit4ClassRunner in spring boot project

I have a spring boot project that needs to test with spring test runner(so that I can get the …

spring-boot powermock springjunit4classrunner
Junit Parameterized tests together with Powermock - how?

I've been trying to figure out how to run parameterized tests in Junit4 together with PowerMock. The problem is that …

java junit powermock parameterized
Mockito throws NullPointer when creating a mock object

I have an integration test in which some set up is done using Guice. I'm using Mockito to mock some …

java mockito powermock