Mocking Scala objects

In this lesson, we’re going to turn our attention to another big topic: mocking the Scala object, also called a singleton object when defined at the top level. Mocking objects is a fairly complex topic; it requires a bit of discussion about how to design your code to have testable objects. You can’t inject an object into a parameter the same way you inject the instance of a class.

Get hands-on with 1400+ tech skills courses.