Tags » Mockito

Expected Exception Rule and Mocking Static Methods - JUnit

Today I was asked to consume a RESTful service so I started implementing it following Robert Cecil Martin’s rules for TDD and came across a new way (atleast for me) of testing the expected exception along with the error message so thought of sharing the way I implemented it as part of this post. 338 more words


Mockito and Deep Stubs

Sometimes when we are writing tests for our projects we don’t want to set any behaviour to a given Mock but at the same time when it’s a complex object, with one or more relations, we want such relations to be accessible/retrievable.  105 more words


Book review -Test-Driven Java Development by Viktor Farcic

I recently finished the book “Test-Driven Java Development” by Viktor Farcic. This is an amazing book and the author does a great job explaining all the tools and frameworks that he uses throughout the book such as Docker, Vagrant, Gradle and so on. 158 more words

Integration Testing

Mocking abstract classes

This post explain mocking abstract classes for testing purposes.


1) This feature is not available in pre 1.10.12 release
2) We can mock abstract class only if it has parameter less constructor… 238 more words


Mock HibernateTemplate with Mockito


Mockito is a useful Java library to create mock Objects for Java Unit Testing.

I used the framework Mockito in order to test objects difficult to test otherwise such as Struts method, Servlet, Hibernate , etc… 338 more words

Non Classé

Verifying the order of multiple method invocations in a single instance

When multiple methods of single instance are invoked in an order in a class. We can verify the order of those method invocations using Mockito’s InOrder functionality. 200 more words