How to use Mockito to Unit test Java Program with JUnit? Example Tutorial

Hello guys, if you are writing unit test your Java application then you would have definitely come across JUnit and Mockito, two of the essential unit testing framework  for Java developers. While JUnit offers support to run your test, setup and teardown and also assertion to check the expected and actual output. Mockito complements JUnit by offering you a mock based testing approach. Mock is nothing but a test double which can return a configured value when a certain method is called. It also provides ability to check if a particular method is called or not. By using Mock object or test double you can check if your code is behaving properly or not in different scenarios. This is also the key difference between JUnit and Mockito, JUnit provides infrastructure to run your test while Mockito provide infrastructure to created Mock objects. 
Java, Unix, Tibco RV and FIX Protocol Tutorial