Sign in Go Pro

Mockito

Mocking and Stubbing Final Classes

 

Up next

Previous

About

In this lesson, we'll explain how to configure Mockito so that it can mock or stub final classes.

Historically, Mockito has never been able to produce test doubles for final classes, but that changed in a later version where it was introduced as an experimental opt-in feature.

This lesson will detail which Mockito version you'll need and how to configure this opt-in feature.

Summary of Content

  • Which version of Mockito is required to mock and stub final classes
  • Which exception you'll see if you attempt to use Mockito with a final class without first enabling the opt-in feature
  • How to add the Mockito MockMaker extension which enables Mockito to work with final classes
  • Showing an example test which successfully makes a test double of a final class

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