tdd-java-demo
tdd java demo with micro-commits
git clone https://9o.is/git/tdd-java-demo.git
commit 7bc787ee31d2b8ee29ba3e5db8d92c3b4e391285 parent 0dffd1f2e84b38a48f52b205fd1b98adfe455106 Author: Jul <jul@9o.is> Date: Wed, 31 Mar 2021 16:35:32 +0800 outputs total of $1.45 for one soup and bread Diffstat:
| M | src/main/java/takehome/Runner.java | | | 2 | +- |
| M | src/test/java/takehome/RunnerTest.java | | | 4 | ++-- |
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/main/java/takehome/Runner.java b/src/main/java/takehome/Runner.java @@ -18,7 +18,7 @@ public class Runner { public void run() { Item[] items = { new Item("soup", 0.65), - new Item("bread", 0) + new Item("bread", 0.80) }; double total = 0; diff --git a/src/test/java/takehome/RunnerTest.java b/src/test/java/takehome/RunnerTest.java @@ -17,12 +17,12 @@ class RunnerTest { assertThat(output(), contains( "How much soup?", "How much bread?", - "Total: $0.65" + "Total: $1.45" )); } private List<String> output() { - ByteArrayInputStream in = new ByteArrayInputStream("1\r0".getBytes()); + ByteArrayInputStream in = new ByteArrayInputStream("1\r1".getBytes()); ByteArrayOutputStream out = new ByteArrayOutputStream(); new Runner(in, out).run(); return Arrays.asList(out.toString().split("\n"));