Tags » Mockito

Are you verifying your stubs?

What is stubbing? What is verifying? Do we need both? If we look into the java docs for Mockito.when() (stubbing) and Mockito.verify() 880 more words
Test Your Code

An example : Unit test using Argument Captor

How do you write unit test for the argument of a method call inside the method which returns void?

Have a look at the code snippet below: 109 more words

Programming

Modern TDD-oriented Java 8 JUnit test template for Idea (with Mockito and AssertJ)

Tune up your JUnit test class template for Idea with the BDD-like syntax, Java 8 and the Mockito-AssertJ duo.

Topics covered in this article may seem trivial.

1,015 more words
Tricks & Tips

Mockito Tutorial

Mockito is a testing framework and widely used now. Lets see how to use this in this tutorial.

I am going to use Maven + Java 8 + Mockito 2.0.2-beta version for this example. 585 more words

Java

Mockito annotations

This is part of a series on unit testing with Mockito and mock objects.

Intro
Mock objects are objects used in the context of unit tests that mock behavior of real objects. 508 more words

Java

Mockito verify

This is part of a series on unit testing with Mockito and mock objects.

Intro
Mock objects are objects used in the context of unit tests that mock behavior of real objects. 603 more words

Java

Mockito When/Then

Mock objects are objects used in the context of unit tests that mock behavior of real objects. A common use case for mock objects is for when you need to test behavior in a service class that depends on database methods in a DAO class. 428 more words

Java