From 0d6f6653255548aa6b5ba427c2cf977e5f39149b Mon Sep 17 00:00:00 2001 From: Andrew Parker Date: Fri, 29 Oct 2010 13:56:29 +0100 Subject: [PATCH] fixing the example. Seems to have lost the changes from the zaphod42 fork --- .../src/test/java/BasicArithmeticTest.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/examples/example_1/src/test/java/BasicArithmeticTest.java b/examples/example_1/src/test/java/BasicArithmeticTest.java index e35d9af..20ea51e 100644 --- a/examples/example_1/src/test/java/BasicArithmeticTest.java +++ b/examples/example_1/src/test/java/BasicArithmeticTest.java @@ -16,7 +16,7 @@ public class BasicArithmeticTest { You need to define an Actor to get started. The Actor performs various actions on the domain objects - in this case we have just one object, the calculator. */ - private Actor operator = new CalculatorActor(); + private CalculatorActor operator = new CalculatorActor(); /* The tests themselves, in given-when-then style. Narrative provides everything used here @@ -49,10 +49,10 @@ except the press() and the_displayed_value() methods defined below, and the Hamc Here we define press() and the_displayed_value(). They just delegate to the corresponding actions on the calculator. */ - private static Action press(final char keypress) { - return new Action() { - public void performFor(Calculator calculator, Stash stash) { - calculator.press(keypress); + private static Action press(final char keypress) { + return new Action() { + public void performFor(CalculatorActor actor) { + actor.tool().press(keypress); } }; } @@ -68,15 +68,19 @@ public String grabFor(CalculatorActor actor) { /* The Actor that does all the work as commanded by the tests. */ - private static class CalculatorActor implements Actor { + private static class CalculatorActor implements Actor { private Calculator calculator = new Calculator(); public Calculator tool() { return calculator; } - public DATA grabUsing(Extractor extractor) { - return extractor.grabFrom(calculator, new HashMapStash()); + public void perform(Action action) { + action.performFor(this); + } + + public DATA grabUsing(Extractor extractor) { + return extractor.grabFor(this); } } }