Top "Powermock" questions

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

Powermock Whitebox invocation with null parameter

I'm trying to test a private method and have the following setup: public class MyClass { private boolean myprivatemethod(ClassB classBObject, …

null mockito powermock white-box
Failed to classload type while reading annotation metadata

I am getting this error on server startup in eclipse. The unit test using PrepareForTest annotation runs fine. I have …

eclipse spring osgi powermock geronimo
why Mock object has doreturn and thenreturn for mock?

Note: I understand that in spy we can differenciate among these two. I went all over internet but I still …

junit mockito powermock powermockito
How do I mock a private static final field initialized via a private constructor using Powermock and Mockito?

Here's my source class - public class ClassToTest extends AbstractSuperClass<Integer> { private static final ClassToTest INSTANCE = new ClassToTest(); // (…

java unit-testing mockito powermock white-box
Testing code which calls native methods

I have a class like this: public final class Foo { public native int getBar(); public String toString() { return "Bar: " + getBar(); } } …

java junit easymock mockito powermock
java.lang.ClassCastException: com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl cannot be cast to

I am using powermock with powermock-easymock-1.5-full.jar. The following exception occurs. These are the all jars i have in …

unit-testing junit mocking easymock powermock
suppress a singleton constructor in java with powermock

I'm trying to unit-test some classes that make use of a Singleton class whose constructor does some things I can't (…

java singleton powermock suppress
Mocking extension function in Kotlin

How to mock Kotlin extension function using Mockito or PowerMock in tests? Since they are resolved statically should they be …

unit-testing mocking mockito kotlin powermock
How can I create dynamic proxy for final Class?

In short: 1. I have some final class that I want to create dynamic proxy for it. How can I do …

java proxy mocking powermock cglib