Mockito – Verify arguments passed to mocks using ArgumentCaptor

In certain scenarios like if we have no control or handle of argument passed into a mock we can use Mockito ArgumentCaptor to verify if certain arguments where passed to mocks. The complete source code used in this article can be cloned from github package com.ourownjava.tdd.mockito.capture; /** * * @author Sanju Thomas * */ public […]
Continue reading…

 

How to mock exceptions using Mockito?

In the previous post I shared a sample program to mock exception conditions using JMockit. Today we will look into exception mocking with Mockito. As I mentioned in the earlier post, during the development time, testing an exception scenario without the help of the second party/third party service developer is not an easy task. However […]
Continue reading…

 

How to mock dependencies using Mockito?

In today’s post I would share a sample program that mock dependencies of the unit under test using Mockito. Mockito is the most simple mocking framework I ever used for java. Mockito is annotation driven and the APIs perfectly written so that you don’t even have to open the API documents to understand it. The complete source […]
Continue reading…