exists and works : • Easiest way to add a regression test is to find some test data, exercise the code, and approve the result • Add approval tests / snapshot tests / Golden master
for BigCo Hamlet: $650.00 (55 seats) As You Like It: $580.00 (35 seats) Othello: $500.00 (40 seats) Amount owed is $1,730.00 You earned 47 credits StatementPrinterTests.exampleStatem ent.approved.txt
amount calculation • For example you can use the Strategy pattern o Tragedy & Comedy • You can also use some kind of factory to retrieve the correct impl. 2) Extract the credits calculation 3) Create a specific Printer implementation • print(Line) • print(Statement)
amount calculation • Create dedicated functions for both types • Tragedy & Comedy • Build a map of these implementations 2) Build a statement 3) Run the pipeline • Iterate • Reduce • Format