Tags » Mockito

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


Different ways of using thenReturn

This post shows 3 different ways of using thenReturn.

1) First way involves configuring the mock object to return only one return value as shown below… 194 more words


Verifying the order of multiple instances method invocation

This post explains how to verify the order in which multiple instances are called. For example lets consider the below class


package package5;

public class Class2 {
    public void method1() {
        System.out.println("Class2 method1");
… 244 more words