Wednesday, July 25, 2018

Simple junit test case with mockito

Mocking is a way to test the functionality of a class in isolation. Mockito facilitates creating mock objects seamlessly. It uses Java Reflection in order to create mock objects for a given interface. Mock objects are nothing but proxy for actual implementations. To know more about mockito, click here.

Maven dependiencies

This is simple junit testing, we will see integration testing in a different article.

Greeting.java
This is the Greeting.java class for which we are writing junit test cases

GreetingTest.java