- Revision
- 1361
- Author
- paul
- Date
- 2009-10-23 18:36:27 -0500 (Fri, 23 Oct 2009)
Log Message
add testcase for JBEHAVE-196
Added Paths
Diff
Added: trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/steps/ConfusingStepsBehavior.java (0 => 1361)
--- trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/steps/ConfusingStepsBehavior.java (rev 0) +++ trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/steps/ConfusingStepsBehavior.java 2009-10-23 23:36:27 UTC (rev 1361) @@ -0,0 +1,45 @@ +package org.jbehave.scenario.steps; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.jbehave.Ensure.ensureThat; +import org.jbehave.scenario.annotations.AfterScenario; +import org.jbehave.scenario.annotations.Given; +import org.jbehave.scenario.annotations.When; +import org.junit.Test; + +import java.util.HashMap; +import java.util.Map; + +public class ConfusingStepsBehavior { + + private Map<String, String> tableRow = new HashMap<String, String>(); + + @Test + public void shouldBeAbleToDisambiguateSimilarSteps() { + MySteps steps = new MySteps(); + CandidateStep[] candidateSteps = steps.getSteps(); + ensureThat(candidateSteps.length, equalTo(2)); + candidateSteps[0].createFrom(tableRow, "Given foo named xyz").perform(); + candidateSteps[1].createFrom(tableRow, "When foo named Bar is created").perform(); + ensureThat(steps.given, equalTo(true)); + ensureThat(steps.when, equalTo(true)); + } + + static class MySteps extends Steps { + private boolean when; + private boolean given; + + @Given("foo named $name") + public void givenFoo(String name) { + given = true; + } + + @When("foo named $name is created") + public void createFoo(String name) { + when = true; + } + + } + + +}
To unsubscribe from this list please visit:
