September 2018
Intermediate to advanced
398 pages
9h 43m
English
Now that we can load some equity data, we need to load inflation data so that we're able to compute inflation-adjusted returns. It is very similar to the loading of equity data.
First, copy cpi_2017.tsv from https://github.com/PacktPublishing/Scala-Programming-Projects/blob/master/Chapter02/retirement-calculator/src/main/resources/cpi.tsv to src/test/resources. Then, create a new unit test called InflationDataSpec in the retcalc package:
package retcalcimport org.scalatest.{Matchers, WordSpec}class InflationDataSpec extends WordSpec with Matchers { "InflationData.fromResource" should { "load CPI data from a tsv file" in { val data = InflationData.fromResource("cpi_2017.tsv") data should ===(Vector( InflationData(
Read now
Unlock full access