Chapter 10

Interesting Times

When we are done with this chapter, we will have a single class to represent Money. The two implementations of times() are close, but not identical:

Franc

Money times(int multiplier) {
   return Money.franc(amount * multiplier);
}

Dollar

Money times(int multiplier) {
   return Money.dollar(amount * multiplier);
}

There’s no obvious way to make them identical. Sometimes you have ...

Get Test Driven Development: By Example 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.