コード例 #1
0
 @Test
 public void testPlusReturnsSum() {
   Expression five = Money.dollar(5);
   Expression result = five.plus(five);
   Sum sum = (Sum) result;
   assertEquals(five, sum.augend);
   assertEquals(five, sum.addend);
 }
コード例 #2
0
 @Test
 public void testSimpleAddition() {
   Expression five = Money.dollar(5);
   Expression sum = five.plus(five);
   Bank bank = new Bank();
   Money reduced = bank.reduce(sum, USD);
   assertEquals(Money.dollar(10), reduced);
 }