1.

What is Mockito? What are some of its advantages?

Answer»

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.


Discussion

No Comment Found