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
Autoplay

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:

Other Relevant Links:

Instructor

Links

Comments

There are no comments on this lesson, start the conversation below ...

>
You need to go PRO to post comments.

Lessons in Mockito