Testing Private Methods and Nested Properties

Learn how to make more fine-grained assertions targeting private and nested properties of a class.

We'll cover the following

Now that we’ve discussed some best practices in ScalaTest, it’s time to explore more syntactic sugar. We’ll start by looking at how we can test nested properties and private methods.

Nested properties

The simplest way to check for nested properties is to rely on direct access. For example, assume we wanted to validate all the properties of a Course.

Get hands-on with 1200+ tech skills courses.