- Revision
- 1003
- Author
- mauro
- Date
- 2008-11-02 03:22:42 -0600 (Sun, 02 Nov 2008)
Log Message
JBEHAVE-131: verify behaviour with multiple aliases. Added aliases to gameoflife example.
Modified Paths
Diff
Modified: trunk/examples/gameoflife/src/scenario/com/lunivore/gameoflife/steps/GridSteps.java (1002 => 1003)
--- trunk/examples/gameoflife/src/scenario/com/lunivore/gameoflife/steps/GridSteps.java 2008-11-02 09:06:59 UTC (rev 1002) +++ trunk/examples/gameoflife/src/scenario/com/lunivore/gameoflife/steps/GridSteps.java 2008-11-02 09:22:42 UTC (rev 1003) @@ -3,6 +3,7 @@ import static org.hamcrest.CoreMatchers.equalTo; import static org.jbehave.Ensure.ensureThat; +import org.jbehave.scenario.annotations.Aliases; import org.jbehave.scenario.annotations.Given; import org.jbehave.scenario.annotations.Then; import org.jbehave.scenario.annotations.When; @@ -17,6 +18,7 @@ private StringRenderer renderer; @Given("a $width by $height game") + @Aliases(values={"a new game: $width by $height"}) public void theGameIsRunning(int width, int height) { game = new Game(width, height); renderer = new StringRenderer(); @@ -29,6 +31,7 @@ } @Then("the grid should look like $grid") + @Aliases(values={"the grid should be $grid"}) public void theGridShouldLookLike(String grid) { ensureThat(renderer.asString(), equalTo(grid)); }
Modified: trunk/examples/gameoflife/src/scenario/com/lunivore/gameoflife/the_grid_starts_empty (1002 => 1003)
--- trunk/examples/gameoflife/src/scenario/com/lunivore/gameoflife/the_grid_starts_empty 2008-11-02 09:06:59 UTC (rev 1002) +++ trunk/examples/gameoflife/src/scenario/com/lunivore/gameoflife/the_grid_starts_empty 2008-11-02 09:22:42 UTC (rev 1003) @@ -1,5 +1,5 @@ -Given a 5 by 5 game -Then the grid should look like +Given new game: 5 by 5 +Then the grid should be ..... ..... .....
Modified: trunk/jbehave-core/src/behaviour/org/jbehave/scenario/steps/StepsBehaviour.java (1002 => 1003)
--- trunk/jbehave-core/src/behaviour/org/jbehave/scenario/steps/StepsBehaviour.java 2008-11-02 09:06:59 UTC (rev 1002) +++ trunk/jbehave-core/src/behaviour/org/jbehave/scenario/steps/StepsBehaviour.java 2008-11-02 09:22:42 UTC (rev 1003) @@ -14,18 +14,21 @@ public void shouldProvideCandidateStepsCorrespondingToAnnotatedSteps() { MySteps steps = new MySteps(); CandidateStep[] candidateSteps = steps.getSteps(); - ensureThat(candidateSteps.length, equalTo(6)); + ensureThat(candidateSteps.length, equalTo(9)); candidateSteps[0].createFrom("Given a given").perform(); candidateSteps[1].createFrom("Given a given alias").perform(); - candidateSteps[2].createFrom("When a when").perform(); - candidateSteps[3].createFrom("When a when alias").perform(); - candidateSteps[4].createFrom("Then a then").perform(); - candidateSteps[5].createFrom("Then a then alias").perform(); + candidateSteps[2].createFrom("Given another given alias").perform(); + candidateSteps[3].createFrom("When a when").perform(); + candidateSteps[4].createFrom("When a when alias").perform(); + candidateSteps[5].createFrom("When another when alias").perform(); + candidateSteps[6].createFrom("Then a then").perform(); + candidateSteps[7].createFrom("Then a then alias").perform(); + candidateSteps[8].createFrom("Then another then alias").perform(); - ensureThat(steps.givens, equalTo(2)); - ensureThat(steps.whens, equalTo(2)); - ensureThat(steps.thens, equalTo(2)); + ensureThat(steps.givens, equalTo(3)); + ensureThat(steps.whens, equalTo(3)); + ensureThat(steps.thens, equalTo(3)); } @Test @@ -83,19 +86,19 @@ private boolean afterUnsuccess; @org.jbehave.scenario.annotations.Given("a given") - @org.jbehave.scenario.annotations.Aliases(values={"a given alias"}) + @org.jbehave.scenario.annotations.Aliases(values={"a given alias", "another given alias"}) public void given() { givens++; } @org.jbehave.scenario.annotations.When("a when") - @org.jbehave.scenario.annotations.Aliases(values={"a when alias"}) + @org.jbehave.scenario.annotations.Aliases(values={"a when alias", "another when alias"}) public void when() { whens++; } @org.jbehave.scenario.annotations.Then("a then") - @org.jbehave.scenario.annotations.Aliases(values={"a then alias"}) + @org.jbehave.scenario.annotations.Aliases(values={"a then alias", "another then alias"}) public void then() { thens++; }
To unsubscribe from this list please visit:
