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 to mock keystore class and assign mock behavior to its methods?

I have the below method which I need to write unit tests for. But I cannot spy the class KeyStore. …

java unit-testing mockito keystore powermockito
PowerMockito+Junit - Mocking System.getenv

The line i try to mock in class is: String x[] = System.getenv("values").split(",") for(int i=0;i<=…

powermockito
Mockito cannot mock this class: interface

I'm having an issue with mockito and powermock, I can mock an abstract class with a final static method with …

java-8 mockito powermock powermockito
Mock Spring Component

I am using Mockito to mock spring beans. It works fine when I mock an interface. In our application, there …

mocking mockito powermock spring-test powermockito
NoSuchMethodError in powermock spring boot?

Trying to Mock private method "mapCustomerToRule" in the same class with PowerMockito Spy but not able to get it. While …

spring-boot powermockito
Junit Error : Invoking the beforeTestMethod method on PowerMock test listener

I haven't touched Mockito for a while, and I have never used it extensively. But today in some new code …

java spring-boot junit mockito powermockito
Jacoco is not showing coverage for PowerMockito classes

We are using Jacoco and eclemma for test case coverage. For the classes that are not using PowerMockRunner we are …

java junit powermockito jacoco-maven-plugin eclemma
Unit test for Runnable with Mockito

I have a code like this for which I would like to write unit test. public class TestClass { private final …

java unit-testing mocking mockito powermockito
How to stub return value for the private method of same class using mockito

I am working on spring based project and writing unit test case using JUnit + Mockito. I am facing a problem …

java unit-testing junit mockito powermockito
How do I mock an implementation class?

I have something like this: public interface SomeInterface { public String someMethod(String someArg1, String someArg2); } public class SomeInterfaceImpl { @Override public …

java unit-testing junit mockito powermockito