diff --git a/src/main/java/org/thoughtworks/linesh/multicurrencymoney/Money.java b/src/main/java/org/thoughtworks/linesh/multicurrencymoney/Money.java index d487838..68379bc 100644 --- a/src/main/java/org/thoughtworks/linesh/multicurrencymoney/Money.java +++ b/src/main/java/org/thoughtworks/linesh/multicurrencymoney/Money.java @@ -40,7 +40,6 @@ public Money times(int multiplier) { return new Money(this.amount * multiplier, currency); } - @Override public Expression plus(Money addend) { return new Sum(this, addend); diff --git a/src/main/java/org/thoughtworks/linesh/multicurrencymoney/Sum.java b/src/main/java/org/thoughtworks/linesh/multicurrencymoney/Sum.java index a26cd83..9660435 100644 --- a/src/main/java/org/thoughtworks/linesh/multicurrencymoney/Sum.java +++ b/src/main/java/org/thoughtworks/linesh/multicurrencymoney/Sum.java @@ -1,8 +1,8 @@ package org.thoughtworks.linesh.multicurrencymoney; public class Sum implements Expression { - public Money augend; - public Money addend; + private Money augend; + private Money addend; public Sum(Money augend, Money addend) { this.augend = augend; @@ -13,4 +13,12 @@ public Sum(Money augend, Money addend) { public Expression plus(Money money) { return null; } + + public Money getAugend() { + return augend; + } + + public Money getAddend() { + return addend; + } } diff --git a/src/test/java/org/thoughtworks/linesh/multicurrencymoney/MoneyTest.java b/src/test/java/org/thoughtworks/linesh/multicurrencymoney/MoneyTest.java index 9589d25..682e67c 100644 --- a/src/test/java/org/thoughtworks/linesh/multicurrencymoney/MoneyTest.java +++ b/src/test/java/org/thoughtworks/linesh/multicurrencymoney/MoneyTest.java @@ -64,8 +64,8 @@ void should_test_our_assumptions_here() { Expression result = fiftyDollars.plus(fiftyDollars); Sum sum = (Sum) result; - assertEquals(fiftyDollars, sum.augend); - assertEquals(fiftyDollars, sum.addend); + assertEquals(fiftyDollars, sum.getAugend()); + assertEquals(fiftyDollars, sum.getAddend()); } } } \ No newline at end of file