Top "Powermockito" questions

Use this tag for questions about PowerMockito, a Java Framework that allows the mocking of usually un-mockable types, i.e. statics, and private methods, in conjunction with the Mockito framework.

How do I return different values on different calls to a mock?

I have the following code which is getting the current counter value from DB. Then it updates the counter in …

java mocking mockito powermockito
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
How can I mock a private static method with PowerMockito?

This is the same question as found here. Unfortunately, the accepted answer isn't working for me. I have a static …

java unit-testing mocking powermockito
How to mock UUID.randomUUID() from java.util package?

What is wrong with the UUID.randomUUID() - it just can't be mocked Is it possible to mock? Or i …

java junit4 powermockito
mockito: The class [X] not prepared for test

After migrating my JAVA EE app. (Spring Web model-view-controller (MVC) framework) from Ant to Maven I have some errors executing …

java spring-mvc junit mockito powermockito
PowerMockito verify private method called x times

I'm using PowerMockito and spy to mock private methods: final SomeClass someClass = new SomeClass(); final SomeClass spy = PowerMockito.spy(someClass); …

java junit powermock powermockito
Real method getting called when Mockito doNothing method is called

I am trying to mock the class KeyStore. After mocking I do not want anything to happen when the load …

java unit-testing mockito powermock powermockito
Instantiating a Class with private constructor using Java/Mockito/PowerMockito

I am writing a test case using JUnit and the method under test takes a final class with a private …

java junit mockito powermockito
PowerMockito: java.lang.NoClassDefFoundError

I need to mock a static final class in my Junit test: private MyFinalClient client; @Before public void setup() { // set …

java unit-testing powermockito
How to mock objects in Kotlin?

I want to test a class that calls an object (static method call in java) but I'm not able to …

android unit-testing kotlin mockito powermockito