Top "Powermock" questions

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

Powermockito doNothing for method with arguments

I've developed an application in Java and I'm trying to create unit tests using Powermockito (I should add that I'm …

java unit-testing powermock
Mock private method using PowerMockito

I'm using PowerMockito to mock the private method call (privateApi) but it still makes the privateApi call which in turn …

java junit powermock
How to mock static method without powermock

Is there any way we can mock the static util method while testing in JUnit? I know Powermock can mock …

java unit-testing junit mockito powermock
Mocked private method with PowerMock, but underlying method still gets called

I am trying to mock out a private method that is making a JNDI call. When that method gets called …

java junit mockito powermock
How to mock a static final variable using JUnit, EasyMock or PowerMock

I want to mock a static final variable as well as mock a i18n class using JUnit, EasyMock or …

java unit-testing junit easymock powermock
mockito test gives no such method error when run as junit test but when jars are added manually in run confugurations, it runs well

I've been facing a peculiar problem. Basically, when I run my Mockito/PowerMockito test normally i.e. 'Run as Junit …

java maven junit mockito powermock
Powermock - java.lang.IllegalStateException: Failed to transform class

Description: I am trying to test a static method from a class. I am using powerMock (1.6.2) + mockito (1.10.19) for mocking along …

java junit mockito powermock
cannot resolve symbol PowerMockRunner

I'm trying to use Powermock for the first time I use build.gradle and added: dependencies { ... testCompile 'org.mockito:mockito-all:1.9.5…

java unit-testing mocking mockito powermock
Mockito asks to add @PrepareForTest for the class even after adding @PrepareForTest

I have the following simple code. I have a class (TestClass) and I want to test "someMethod". There is an …

java mockito powermock
Unable to run JUnit test with PowerMockRunner

I have a Gradle based Java project were I now want to mock a private method using PowerMock. The problem …

java exception junit powermock