September 2018
Intermediate to advanced
398 pages
9h 43m
English
Now, we would like to have a nice representation of the person by stating his/her name and age. The test should look like the following:
"Get a human readable representation of the person" in { val paul = Person(firstName = "Paul", lastName = "Smith", age = 24) paul.description should be("Paul Smith is 24 years old")}
Run the test again. We will get a compilation error:

This is expected as the function doesn't exist on the Person class. To implement it, add the expected implementation by setting the cursor on the description() error in the MainSpec.scala class, hitting Alt + Enter, and selecting the create method ...
Read now
Unlock full access