Sign in Go Pro


Argument Captors

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson



#### Argument Captor In this lesson, we'll explain how to verify the parameters which are passed to mock objects. We'll explain how Argument Captors work and how you can use them to ensure that not only is your mock method being called, but that it is being called with the correct parameter. #### Summary of Content - Showing an example where we need to not only verify that a mock method was called, but we also need interrogate the parameter passed to a mock method - Explanation of what an Argument Captor is - How to create an Argument Captor, using the `ArgumentCaptor.forClass()` method - How to retrieve the object that was _captured_ by the argument captor, using the `getValue()` method - Showing a test passing which successfully verifies the parameter passed to a mock object. ####Other Relevant Links: - []( - [](

Lessons in Mockito