tdd-java-demo
tdd java demo with micro-commits
git clone https://9o.is/git/tdd-java-demo.git
commit d98e793d2b065c0a41cf209b510fce45e6210b45 parent 8605b5c811158f50c90f8047d5b22e3ae6f1fcb7 Author: Jul <jul@9o.is> Date: Wed, 31 Mar 2021 16:20:32 +0800 strengthen Runner tests Diffstat:
| M | src/test/java/takehome/RunnerTest.java | | | 16 | ++-------------- |
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/src/test/java/takehome/RunnerTest.java b/src/test/java/takehome/RunnerTest.java @@ -13,27 +13,15 @@ import static org.hamcrest.Matchers.contains; class RunnerTest { @Test - public void noItems() { + public void example() { assertThat(output(), contains( "How much soup?", - "Total: $0.00" - )); - } - - @Test - public void oneSoup() { - assertThat(output("1"), contains( - "How much soup?", "Total: $0.65" )); } private List<String> output() { - return output("0"); - } - - private List<String> output(String input) { - ByteArrayInputStream in = new ByteArrayInputStream(input.getBytes()); + ByteArrayInputStream in = new ByteArrayInputStream("1".getBytes()); ByteArrayOutputStream out = new ByteArrayOutputStream(); new Runner(in, out).run(); return Arrays.asList(out.toString().split("\n"));