Unit testing Scala applications

In this section, we will discuss how to unit test Scala components using the ScalaTest unit testing framework. Most or all of the Scala-based applications use Case classes to represent their Data Models, so we should learn how to unit test Case classes.

Refer to the scala-fp-app project from Chapter 2Functional Scala, GitHub repository. It contains the following Case class to represent our WF Reactive System data model:

    package com.packt.publishing.caseclass 
    case class WeatherForecast (city: String, date: String, hour:     String, temperature: String) 

Perform the following steps to unit test WeatherForecast data model:

  1. Write unit tests to test each and every data value of this data model using the ScalaTest ...

Get Scala Reactive Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.