From a42819fab1953487345a32dd9e9c4de41999e4f5 Mon Sep 17 00:00:00 2001 From: linesh Date: Sun, 8 Jan 2017 16:45:31 +0800 Subject: [PATCH] [#3] Modify test to use $50 and pass in real augend&addends --- .../thoughtworks/linesh/multicurrencymoney/Money.java | 4 ++-- .../linesh/multicurrencymoney/MoneyTest.java | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/thoughtworks/linesh/multicurrencymoney/Money.java b/src/main/java/org/thoughtworks/linesh/multicurrencymoney/Money.java index 49e18b7..d487838 100644 --- a/src/main/java/org/thoughtworks/linesh/multicurrencymoney/Money.java +++ b/src/main/java/org/thoughtworks/linesh/multicurrencymoney/Money.java @@ -42,7 +42,7 @@ public Money times(int multiplier) { @Override - public Expression plus(Money money) { - return new Sum(Money.dollar(5), Money.dollar(5)); + public Expression plus(Money addend) { + return new Sum(this, addend); } } diff --git a/src/test/java/org/thoughtworks/linesh/multicurrencymoney/MoneyTest.java b/src/test/java/org/thoughtworks/linesh/multicurrencymoney/MoneyTest.java index 6a2c01f..9589d25 100644 --- a/src/test/java/org/thoughtworks/linesh/multicurrencymoney/MoneyTest.java +++ b/src/test/java/org/thoughtworks/linesh/multicurrencymoney/MoneyTest.java @@ -4,8 +4,6 @@ import org.junit.jupiter.api.Test; import support.Tasking; -import java.lang.reflect.Field; - import static org.junit.jupiter.api.Assertions.*; class MoneyTest { @@ -62,12 +60,12 @@ void should_get_10_dollars_when_adding_5_dollars_with_5_dollars() { @Test void should_test_our_assumptions_here() { - Money fiveDollars = Money.dollar(5); - Expression result = fiveDollars.plus(fiveDollars); + Money fiftyDollars = Money.dollar(50); + Expression result = fiftyDollars.plus(fiftyDollars); Sum sum = (Sum) result; - assertEquals(fiveDollars, sum.augend); - assertEquals(fiveDollars, sum.addend); + assertEquals(fiftyDollars, sum.augend); + assertEquals(fiftyDollars, sum.addend); } } } \ No newline at end of file