Chapter 2. Creating Mocks

In this chapter, we will cover the following recipes:

  • Creating mocks in code
  • Creating mocks with annotations
  • Creating mocks with a different default answer
  • Creating mocks with different default answers with annotations
  • Creating mocks with custom configuration
  • Creating mocks of final classes with PowerMock
  • Creating mocks of enums with PowerMock