Book Image

Mockito Cookbook

By : Marcin Grzejszczak
Book Image

Mockito Cookbook

By: Marcin Grzejszczak

Overview of this book

Table of Contents (17 chapters)
Mockito Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 5. Stubbing Behavior of Spies

In this chapter, we will cover the following recipes:

  • Stubbing methods that return values

  • Stubbing methods so that they throw exceptions

  • Stubbing methods so that they return custom answers

  • Stubbing void methods

  • Stubbing void methods so that they throw exceptions

  • Stubbing void methods so that they return custom answers

  • Stubbing final methods with PowerMock