September 2018
Intermediate to advanced
398 pages
9h 43m
English
The entry point of our SimulatePlanApp application calls simulatePlan. We need to change it to return the text of any error that could occur.
First, we need to change the integration test to add a new test case. Open SimulatePlanIT.scala and add the following test:
"SimulatePlanApp.strMain" should { "simulate a retirement plan using market returns" in {...} "return an error when the period exceeds the returns bounds" in { val actualResult = SimulatePlanApp.strMain( Array("1952.09,2017.09", "25", "60", "3000", "2000", "10000")) val expectedResult = "Cannot get the return for month 780. Accepted range: 0 to 779" actualResult should === (expectedResult) } }
Then, open SimulatePlanApp.scala and change the implementation ...
Read now
Unlock full access