Testing traits
Testing is a really important part of software development. It ensures that changes to a certain piece of code do not end up producing errors either in the methods that were changed, or somewhere else.
There are different testing frameworks that one can use, and it really is a matter of personal preference. In this book, we have used ScalaTest (http://www.scalatest.org), as this is the one I use in my projects; it is understandable, readable, and easy to use.
In some cases, if a trait is mixed into a class, we could end up testing the class. However, we might want to test only a specific trait. It does not make much sense to test a trait that doesn't have all its methods implemented, so here we will look into the ones that have their code written (mixins). Also, the unit tests that we will show here are quite simple but they are just for illustration purposes. We will be looking into more complex and meaningful tests in the following chapters of this book.