
MOCKITO COOKBOOK
By :

If not changed by the custom configuration, Mockito sets the mock ReturnsEmptyValues
answer by default (for details on that answer, please check the subsequent There's more... section). Note that in Chapter 4, Stubbing Behavior of Mocks, where we deal with stubbing of particular methods, you can learn how to stub particular methods with a custom answer.
In the following recipe, we will see how to change the default answer to a custom or a predefined one.
It is more than probable that you will not ever need to create a custom answer for Mockito—there are plenty of them already bundled in Mockito and there is no need to reinvent the wheel. Why would you want to create a custom answer anyway? Let's take a look at a couple of possible answers to that question:
Change the font size
Change margin width
Change background colour