Top "Mockito" questions

Mockito is a mocking framework for Java.

Mockito How to mock only the call of a method of the superclass

I'm using Mockito in some tests. I have the following classes: class BaseService { public void save() {...} } public Childservice extends BaseService { …

java mockito
Using Mockito, how do I verify a method was a called with a certain argument?

I'm using Mockito 1.9.0. How would i verify that a method got called exactly once, and that one of the fields …

java mocking mockito
Mocking Logger and LoggerFactory with PowerMock and Mockito

I have the following Logger I want to mock out, but to validate log entries are getting called, not for …

java junit mockito slf4j powermock
Mockito, JUnit and Spring

I started to learn about Mockito only today. I wrote some simple test (with JUnit, see below), but I can't …

java spring unit-testing mockito
What is the difference between mocking and spying when using Mockito?

What would be a use case for a use of a Mockito spy? It seems to me that every spy …

java testing mocking mockito
Mocking methods of local scope objects with Mockito

I need some help with this: Example: void method1{ MyObject obj1=new MyObject(); obj1.method1(); } I want to mock obj1.…

object mocking local mockito
How do I mock a static method that returns void with PowerMock?

I have a few static util methods in my project, some of them just pass or throw an exception. There …

static mocking mockito void powermock
Finding import static statements for Mockito constructs

I'm trying to crash through the brick wall between me and Mockito. I've torn my hair out over trying to …

java mockito static-import
How to verify static void method has been called with power mockito

I am using the following. Powermock-mockito 1.5.12 Mockito 1.95 junit 4.11 Here is my utils class public void InternalUtils { public static void sendEmail(…

java unit-testing mockito static-methods
Mocking python function based on input arguments

We have been using Mock for python for a while. Now, we have a situation in which we want to …

python unit-testing mocking mockito