Chapter 6. Verifying Test Doubles

In this chapter, we will cover the following topics:

  • Verifying the method invocation count with times()
  • Verifying the method invocation count with atLeast()
  • Verifying the method invocation count with atMost()
  • Verifying that interactions never happened
  • Verifying that interactions stopped happening
  • Verifying the order of interactions
  • Verifying interactions and ignoring stubbed methods
  • Verifying the method invocation within the specified time

Introduction

In the previous two chapters, you've been shown how to stub the mocked object's behavior in a number of ways. You can also see the verification approach that favors the assertion of what should happen instead of how it should happen, by telling you to verify the behavior, ...

Get Mockito Cookbook 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.