"Any sufficiently advanced technology is indistinguishable from magic."
– Arthur C. Clarke
This chapter explores the advanced topics of the Mockito framework. Using Mockito's advanced features, we can stub out void methods, capture arguments passed to the stubbed methods and assert the argument values, verify the invocation order to check that the collaborators are accessed in proper order, spy a real object and set expectation on the spy object in the legacy code, and change mocking behavior.
The following topics are covered in this chapter:
Verifying an invocation order
Spying an object
Changing default Mockito settings
Resetting mock objects