Sign in Go Pro

Mockito

Stubs - Default Return Values

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson

Up next

Previous

About

# Description 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 # Code Links: - https://github.com/CDRussell/Mockito # Other Relevant Links: - http://mockito.org/ - https://github.com/mockito/mockito

Instructor

Links

Lessons in Mockito