Google News
logo
JUnit - Interview Questions
What is Mockito? What are some of its advantages?
Mockito is an open-source, Java-based, mocking framework that allows the creation of test objects that simulate the behaviour (mock) of real-world objects. This helps in achieving test-driven or behaviour-driven development. The framework allows developers to verify system behaviours without establishing expectations. Mockito framework attempts to eliminate expect-run-verify development patterns by removing external specifications and dependencies. Some of the advantages of Mockito are :
 
* Mocks are created at runtime, hence reordering method input parameters or renaming interface methods will not break test code.
* Mockito supports returning of values.
* It supports exception simulation
* It provides a check on the order of method calls.
* It helps in creating mock objects using annotation.
Advertisement