Summary

This chapter covered the advanced Mockito framework topics such as working with void methods, throwing exception from void methods, writing callbacks for void methods, returning value using doReturn, void method chaining, and calling original method. It also covered Mockito annotations, verifying arguments using argument captor, verifying an invocation order, spying objects using spy, changing default Mockito settings, resetting mock objects, inline stubbing, and mock details.

By now, you should be able to use advanced Mockito features.

The next chapter in line, Behavior-driven Development with Mockito, covers the BDD concepts, scenarios, test conventions, and examples of BDD with Mockito.

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.