This lesson describes how Mockito supports returning default values for certain data types, which can reduce the amount of setup required in unit tests.
It discusses which data types are supported and how Mockito decides whether to return a user-specified value, a default value or null.
Summary of Content:
- Mockito will return sensible default values for stubs
- Supported data types for default return values
- Mockito provides default values for primitives, primitive wrappers and collections
- What Mockito doesn't provide defaults for
- How Mockito decides which value to return for each method return type
- Walkthrough of Mockito source code to see how default return types are implemented