Chapter 3. Accelerating Mockito
"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:
- Void methods
- Annotations
- Argument captor
- Verifying an invocation order
- Spying an object
- Changing default Mockito settings
- Resetting mock objects
- Inline stubbing
- Mock details
Learning advanced ...
Get Mockito Essentials now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.