Chapter 4. Stubbing Behavior of Mocks
In this chapter, we will cover the following recipes:
- Using argument matchers for stubbing
- Stubbing methods that return values
- Stubbing methods so they throw exceptions
- Stubbing methods so they return custom answers
- Stubbing methods so they call real methods
- Stubbing void methods
- Stubbing void methods so they throw exceptions
- Stubbing void methods so they return custom answers
- Stubbing final methods with PowerMock
- Stubbing static methods with PowerMock
- Stubbing object instantiation with PowerMock