Mockito
Mockito is a mocking framework with a clean and simple API. Tests produced with Mockito are readable, easy to write, and intuitive. It contains three major static methods:
mock(): This is used to create mocks. Optionally, we can specify how those mocks behave withwhen()andgiven().spy(): This can be used for partial mocking. Spied objects invoke real methods unless we specify otherwise. As withÂmock(), behavior can be set for every public or protected method (excluding static). The major difference is thatmock()creates a fake of the whole object, whilespy()uses the real object.verify(): This is used to check whether methods were called with given arguments. It is a form of assert.
We'll go deeper into Mockito once we start coding our Tic-Tac-Toe v2 application. First, however, let us quickly go through a new set of requirements.