Sign in Go Pro

Mockito

Verifying a Method Was Called An Exact Number of Times

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson

Up next

Previous

About

In this lesson, we'll explain how the `times()` verification mode works and how it is used to verify that a method was called a certain number of times. ###Summary of Content - The default implementation of `Mockito.verify()` - What errors you'll see when you call a method an unexpected number of times - Customising the verification using _Verification Modes_ - Overloaded method for `Mockito.verify()` which accepts a way of specifying how many times a method should be called as part of its verification - How to use the `times()` verification mode to verify a mock object had its method called a certain number of times

Lessons in Mockito