Top "Powermock" questions

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

Mockito / PowerMocktio doNothing for none void method

I need a method which returns something to do nothing when invoked during testing, the class instance which owns the …

java unit-testing junit mockito powermock
Why not PowerMock

I am working on a project where we are currently doing testing with JUnit and Mockito. Now I am trying …

java junit mockito powermock
Is it possible to mock a static method on a final class using a PowerMockRule instead of the PowerMockRunner?

According to the PowerMock docs, I should be able to run using a PowerMockRule instead of @RunWith(PowerMockRunner.class) and …

junit mockito powermock junit-runner junit-rule
Bad <init> method call from inside of a branch

After upgrading JDK to java7u65 several unit-tests utilizing Mockito and PowerMock started to fail with following causes: 15:15:23,807 INFO - …

java maven powermock javassist
Mocking singleton with PowerMockito

in order to test one of the private method I coded, I need to mock a Singleton. After testing several …

java testing mockito junit4 powermock
java.lang.LinkageError: ClassCastException

I do experience a really annoying problem with TestNG and RESTeasy. I do have a class that runs several tests …

java classloader testng mockito powermock
Partial Mock Private Method with PowerMock-Mockito

I am new to Mockito and PowerMock. I need to test some legacy code which has a private method I …

java junit mockito powermock private-methods
PowerMock & Java 11

We are using PowerMock in few of our historical projects. Unfortunately PowerMock is quite dead and is not compatible with …

java junit powermock powermockito
PowerMock LinkageError: MockClassLoader javax/management/MBeanServer

I'm seeing the following PowerMock/EasyMock error with the following JARS: Jars activemq-all-5.9.0.jar com.ibm.mq.headers-7.0.1.5.jar com.…

java junit jar easymock powermock
How to mock non static methods using PowerMock

I am trying to mock an inner method call of my test method My class looks like this public class …

powermock non-static