Home » Core Java » Mockito » Page 3


Mockito void Method Example

In Mockito Hello World Example, we have learnt how to stub a non-void method that returns something. Sometimes we may also need to stub a void method which is what I am going to show in this article. Before I start with my example, a bit about my setup: I am using Maven – the build tool Eclipse  as the IDE, version Luna 4.4.1. ...

Read More »

Mockito Spy Example

In this article, I am going to show you an example of Mockito Spy calls. There are times when we would like to use most of the original object’s behavior but mock only a portion of it. This is called spying objects, also called partial mocking. Before I start with the example, let me first brief you about my setup: ...

Read More »

Mockito Hello World Example

You are here, it means either you are interested in the mock objects or you are already aware of Mockito, and you want to see a working example of it. Well…let me first introduce you to Mockito which is an open source mock unit testing framework for Java. In this article, I am going to show you a Hello World example ...

Read More »