Chapter 12. Addition, Finally

$5 + 10 CHF = $10 if rate is 2:1

It's a new day, and our to-do list has become a bit cluttered, so we'll copy the pending items to a fresh list. (I like physically copying to-do items to a new list. If there are lots of little items, I tend just to take care of them rather than copy them. Little stuff that otherwise might build up gets taken care of just because I'm lazy. Play to your strengths.)

$5 + 10 CHF = $10 if rate is 2:1$5 + $5 = $10

I'm not sure how to write the story of the whole addition, so we'll start with a simpler example: $5 + $5 = $10.

public void testSimpleAddition() {
					Money sum= Money.dollar(5).plus(Money.dollar(5));
					assertEquals(Money.dollar(10), sum);
					}
				

We could fake the ...

Get Test Driven Development: By Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.