Top "Mockito" questions

Mockito is a mocking framework for Java.

Mockito test a void method throws an exception

I have a method with a void return type. It can also throw a number of exceptions so I'd like …

java exception mocking mockito
How to mock a final class with mockito

I have a final class, something like this: public final class RainOnTrees{ public void startRain(){ // some code here } } I am …

java junit mockito
Difference between @Mock and @InjectMocks

What is the difference between @Mock and @InjectMocks in Mockito framework?

java unit-testing mocking mockito
Can Mockito capture arguments of a method called multiple times?

I have a method that gets called twice, and I want to capture the argument of the second method call. …

java unit-testing mocking mockito
Mockito. Verify method arguments

I've googled about this, but didn't find anything relevant. I've got something like this: Object obj = getObject(); Mockeable mock= Mockito.…

java unit-testing junit mockito
Mockito match any class argument

Is there a way to match any class argument of the below sample routine? class A { public B method(Class&…

java class mockito arguments matcher
Mocking member variables of a class using Mockito

I am a newbie to development and to unit tests in particular . I guess my requirement is pretty simple, but …

java mocking mockito
Injecting Mockito mocks into a Spring bean

I would like to inject a Mockito mock object into a Spring (3+) bean for the purposes of unit testing with …

spring dependency-injection junit annotations mockito
Mock a constructor with parameter

I have a class as below: public class A { public A(String test) { bla bla bla } public String check() { bla …

java junit mocking mockito powermock
Using Mockito with multiple calls to the same method with the same arguments

Is there a way to have a stubbed method return different objects on subsequent invocations? I'd like to do this …

java mocking mockito