- Revision
- 951
- Author
- mauro
- Date
- 2008-09-28 11:33:06 -0500 (Sun, 28 Sep 2008)
Log Message
JBEHAVE-134: Extracted CandidateSteps interface from Steps.
Modified Paths
- trunk/jbehave-core/src/behaviour/org/jbehave/scenario/ScenarioBehaviour.java
- trunk/jbehave-core/src/behaviour/org/jbehave/scenario/ScenarioRunnerBehaviour.java
- trunk/jbehave-core/src/behaviour/org/jbehave/scenario/steps/UnmatchedToPendingStepCreatorBehaviour.java
- trunk/jbehave-core/src/java/org/jbehave/scenario/AbstractScenario.java
- trunk/jbehave-core/src/java/org/jbehave/scenario/JUnitScenario.java
- trunk/jbehave-core/src/java/org/jbehave/scenario/Scenario.java
- trunk/jbehave-core/src/java/org/jbehave/scenario/ScenarioRunner.java
- trunk/jbehave-core/src/java/org/jbehave/scenario/steps/CandidateStep.java
- trunk/jbehave-core/src/java/org/jbehave/scenario/steps/StepCreator.java
- trunk/jbehave-core/src/java/org/jbehave/scenario/steps/Steps.java
- trunk/jbehave-core/src/java/org/jbehave/scenario/steps/UnmatchedToPendingStepCreator.java
Added Paths
Diff
Modified: trunk/jbehave-core/src/behaviour/org/jbehave/scenario/ScenarioBehaviour.java (950 => 951)
--- trunk/jbehave-core/src/behaviour/org/jbehave/scenario/ScenarioBehaviour.java 2008-09-28 15:25:43 UTC (rev 950) +++ trunk/jbehave-core/src/behaviour/org/jbehave/scenario/ScenarioBehaviour.java 2008-09-28 16:33:06 UTC (rev 951) @@ -13,6 +13,7 @@ import org.jbehave.scenario.errors.PendingErrorStrategy; import org.jbehave.scenario.parser.ScenarioDefiner; import org.jbehave.scenario.reporters.ScenarioReporter; +import org.jbehave.scenario.steps.CandidateSteps; import org.jbehave.scenario.steps.StepCreator; import org.jbehave.scenario.steps.Steps; import org.junit.Test; @@ -28,7 +29,7 @@ public void shouldLoadStoryDefinitionAndRunUsingTheScenarioRunner() throws Throwable { ScenarioRunner runner = mock(ScenarioRunner.class); MockedConfiguration configuration = new MockedConfiguration(); - Steps steps = mock(Steps.class); + CandidateSteps steps = mock(Steps.class); RunnableScenario scenario = new MyScenario(runner, configuration, steps); StoryDefinition storyDefinition = new StoryDefinition(Blurb.EMPTY, Collections.EMPTY_LIST); @@ -42,7 +43,7 @@ private class MyScenario extends JUnitScenario { public MyScenario(ScenarioRunner runner, - MockedConfiguration configuration, Steps steps) { + MockedConfiguration configuration, CandidateSteps steps) { super(runner, configuration, steps); }
Modified: trunk/jbehave-core/src/behaviour/org/jbehave/scenario/ScenarioRunnerBehaviour.java (950 => 951)
--- trunk/jbehave-core/src/behaviour/org/jbehave/scenario/ScenarioRunnerBehaviour.java 2008-09-28 15:25:43 UTC (rev 950) +++ trunk/jbehave-core/src/behaviour/org/jbehave/scenario/ScenarioRunnerBehaviour.java 2008-09-28 16:33:06 UTC (rev 951) @@ -16,6 +16,7 @@ import org.jbehave.scenario.errors.PendingErrorStrategy; import org.jbehave.scenario.reporters.ScenarioReporter; import org.jbehave.scenario.steps.CandidateStep; +import org.jbehave.scenario.steps.CandidateSteps; import org.jbehave.scenario.steps.Step; import org.jbehave.scenario.steps.StepCreator; import org.jbehave.scenario.steps.StepResult; @@ -40,7 +41,7 @@ ScenarioReporter reporter = mock(ScenarioReporter.class); StepCreator creator = mock(StepCreator.class); - Steps mySteps = mock(Steps.class); + CandidateSteps mySteps = mock(Steps.class); stub(mySteps.getSteps()).toReturn(someCandidateSteps); IllegalArgumentException anException = new IllegalArgumentException(); @@ -164,7 +165,7 @@ stub(pendingStep.perform()).toReturn(StepResult.pending("pendingStep")); stub(secondStep.perform()).toReturn(StepResult.success("secondStep")); StepCreator creator = mock(StepCreator.class); - Steps mySteps = mock(Steps.class); + CandidateSteps mySteps = mock(Steps.class); ScenarioDefinition scenario1 = mock(ScenarioDefinition.class); ScenarioDefinition scenario2 = mock(ScenarioDefinition.class);
Modified: trunk/jbehave-core/src/behaviour/org/jbehave/scenario/steps/UnmatchedToPendingStepCreatorBehaviour.java (950 => 951)
--- trunk/jbehave-core/src/behaviour/org/jbehave/scenario/steps/UnmatchedToPendingStepCreatorBehaviour.java 2008-09-28 15:25:43 UTC (rev 950) +++ trunk/jbehave-core/src/behaviour/org/jbehave/scenario/steps/UnmatchedToPendingStepCreatorBehaviour.java 2008-09-28 16:33:06 UTC (rev 951) @@ -16,7 +16,7 @@ UnmatchedToPendingStepCreator creator = new UnmatchedToPendingStepCreator(); CandidateStep candidate = mock(CandidateStep.class); - Steps steps = mock(Steps.class); + CandidateSteps steps = mock(Steps.class); Step executableStep = mock(Step.class); stub(candidate.matches("my step")).toReturn(true); @@ -37,7 +37,7 @@ UnmatchedToPendingStepCreator creator = new UnmatchedToPendingStepCreator(); CandidateStep candidate = mock(CandidateStep.class); - Steps steps = mock(Steps.class); + CandidateSteps steps = mock(Steps.class); Step executableStep = mock(Step.class); stub(candidate.matches("my step")).toReturn(false);
Modified: trunk/jbehave-core/src/java/org/jbehave/scenario/AbstractScenario.java (950 => 951)
--- trunk/jbehave-core/src/java/org/jbehave/scenario/AbstractScenario.java 2008-09-28 15:25:43 UTC (rev 950) +++ trunk/jbehave-core/src/java/org/jbehave/scenario/AbstractScenario.java 2008-09-28 16:33:06 UTC (rev 951) @@ -3,7 +3,7 @@ import org.jbehave.scenario.definition.KeyWords; import org.jbehave.scenario.definition.StoryDefinition; import org.jbehave.scenario.parser.ScenarioNameResolver; -import org.jbehave.scenario.steps.Steps; +import org.jbehave.scenario.steps.CandidateSteps; /** * <p> @@ -40,20 +40,20 @@ private final Configuration configuration; private final ScenarioRunner scenarioRunner; - private final Steps[] candidateSteps; + private final CandidateSteps[] candidateSteps; private final Class<? extends RunnableScenario> scenarioClass; - public AbstractScenario(Class<? extends RunnableScenario> scenarioClass, Steps... candidateSteps) { + public AbstractScenario(Class<? extends RunnableScenario> scenarioClass, CandidateSteps... candidateSteps) { this(scenarioClass, new PropertyBasedConfiguration(), candidateSteps); } public AbstractScenario(Class<? extends RunnableScenario> scenarioClass, Configuration configuration, - Steps... candidateSteps) { + CandidateSteps... candidateSteps) { this(scenarioClass, new ScenarioRunner(), configuration, candidateSteps); } public AbstractScenario(Class<? extends RunnableScenario> scenarioClass, ScenarioRunner scenarioRunner, - Configuration configuration, Steps... candidateSteps) { + Configuration configuration, CandidateSteps... candidateSteps) { this.scenarioClass = scenarioClass; this.configuration = configuration; this.scenarioRunner = scenarioRunner;
Modified: trunk/jbehave-core/src/java/org/jbehave/scenario/JUnitScenario.java (950 => 951)
--- trunk/jbehave-core/src/java/org/jbehave/scenario/JUnitScenario.java 2008-09-28 15:25:43 UTC (rev 950) +++ trunk/jbehave-core/src/java/org/jbehave/scenario/JUnitScenario.java 2008-09-28 16:33:06 UTC (rev 951) @@ -2,7 +2,7 @@ import junit.framework.TestCase; -import org.jbehave.scenario.steps.Steps; +import org.jbehave.scenario.steps.CandidateSteps; import org.junit.Test; /** @@ -27,15 +27,15 @@ private final Class<? extends JUnitScenario> decoratorClass = this.getClass(); private final RunnableScenario delegate; - public JUnitScenario(Steps... candidateSteps) { + public JUnitScenario(CandidateSteps... candidateSteps) { this.delegate = new JUnitScenarioDelegate(decoratorClass, candidateSteps); } - public JUnitScenario(Configuration configuration, Steps... candidateSteps) { + public JUnitScenario(Configuration configuration, CandidateSteps... candidateSteps) { this.delegate = new JUnitScenarioDelegate(decoratorClass, configuration, candidateSteps); } - public JUnitScenario(ScenarioRunner scenarioRunner, Configuration configuration, Steps... candidateSteps) { + public JUnitScenario(ScenarioRunner scenarioRunner, Configuration configuration, CandidateSteps... candidateSteps) { this.delegate = new JUnitScenarioDelegate(decoratorClass, scenarioRunner, configuration, candidateSteps); } @@ -61,17 +61,17 @@ public static class JUnitScenarioDelegate extends AbstractScenario { - public JUnitScenarioDelegate(Class<? extends RunnableScenario> decoratorClass, Steps... candidateSteps) { + public JUnitScenarioDelegate(Class<? extends RunnableScenario> decoratorClass, CandidateSteps... candidateSteps) { super(decoratorClass, candidateSteps); } public JUnitScenarioDelegate(Class<? extends RunnableScenario> decoratorClass, Configuration configuration, - Steps... candidateSteps) { + CandidateSteps... candidateSteps) { super(decoratorClass, configuration, candidateSteps); } public JUnitScenarioDelegate(Class<? extends RunnableScenario> decoratorClass, ScenarioRunner scenarioRunner, - Configuration configuration, Steps... candidateSteps) { + Configuration configuration, CandidateSteps... candidateSteps) { super(decoratorClass, scenarioRunner, configuration, candidateSteps); }
Modified: trunk/jbehave-core/src/java/org/jbehave/scenario/Scenario.java (950 => 951)
--- trunk/jbehave-core/src/java/org/jbehave/scenario/Scenario.java 2008-09-28 15:25:43 UTC (rev 950) +++ trunk/jbehave-core/src/java/org/jbehave/scenario/Scenario.java 2008-09-28 16:33:06 UTC (rev 951) @@ -1,6 +1,6 @@ package org.jbehave.scenario; -import org.jbehave.scenario.steps.Steps; +import org.jbehave.scenario.steps.CandidateSteps; /** * <p> @@ -12,15 +12,15 @@ */ public abstract class Scenario extends JUnitScenario { - public Scenario(Steps... candidateSteps) { + public Scenario(CandidateSteps... candidateSteps) { super(candidateSteps); } - public Scenario(Configuration configuration, Steps... candidateSteps) { + public Scenario(Configuration configuration, CandidateSteps... candidateSteps) { super(configuration, candidateSteps); } - public Scenario(ScenarioRunner scenarioRunner, Configuration configuration, Steps... candidateSteps) { + public Scenario(ScenarioRunner scenarioRunner, Configuration configuration, CandidateSteps... candidateSteps) { super(scenarioRunner, configuration, candidateSteps); }
Modified: trunk/jbehave-core/src/java/org/jbehave/scenario/ScenarioRunner.java (950 => 951)
--- trunk/jbehave-core/src/java/org/jbehave/scenario/ScenarioRunner.java 2008-09-28 15:25:43 UTC (rev 950) +++ trunk/jbehave-core/src/java/org/jbehave/scenario/ScenarioRunner.java 2008-09-28 16:33:06 UTC (rev 951) @@ -6,9 +6,9 @@ import org.jbehave.scenario.errors.PendingError; import org.jbehave.scenario.errors.PendingErrorStrategy; import org.jbehave.scenario.reporters.ScenarioReporter; +import org.jbehave.scenario.steps.CandidateSteps; import org.jbehave.scenario.steps.Step; import org.jbehave.scenario.steps.StepResult; -import org.jbehave.scenario.steps.Steps; /** * Runs the steps of each scenario in a story @@ -28,7 +28,7 @@ public ScenarioRunner() { } - public void run(StoryDefinition story, Configuration configuration, Steps... candidateSteps) throws Throwable { + public void run(StoryDefinition story, Configuration configuration, CandidateSteps... candidateSteps) throws Throwable { reporter = configuration.forReportingScenarios(); pendingStepStrategy = configuration.forPendingSteps(); errorStrategy = configuration.forHandlingErrors();
Modified: trunk/jbehave-core/src/java/org/jbehave/scenario/steps/CandidateStep.java (950 => 951)
--- trunk/jbehave-core/src/java/org/jbehave/scenario/steps/CandidateStep.java 2008-09-28 15:25:43 UTC (rev 950) +++ trunk/jbehave-core/src/java/org/jbehave/scenario/steps/CandidateStep.java 2008-09-28 16:33:06 UTC (rev 951) @@ -18,13 +18,13 @@ public class CandidateStep { private final Method method; - private final Steps steps; + private final CandidateSteps steps; private final StepMonitor stepMonitor; private final ParameterConverters parameterConverters; private final String[] startingWords; private final Pattern pattern; - public CandidateStep(String matchThis, Method method, Steps steps, StepPatternBuilder patterBuilder, + public CandidateStep(String matchThis, Method method, CandidateSteps steps, StepPatternBuilder patterBuilder, StepMonitor stepMonitor, ParameterConverters parameterConverters, String... startingWords) { this.method = method; this.steps = steps;
Added: trunk/jbehave-core/src/java/org/jbehave/scenario/steps/CandidateSteps.java (0 => 951)
--- trunk/jbehave-core/src/java/org/jbehave/scenario/steps/CandidateSteps.java (rev 0) +++ trunk/jbehave-core/src/java/org/jbehave/scenario/steps/CandidateSteps.java 2008-09-28 16:33:06 UTC (rev 951) @@ -0,0 +1,10 @@ +package org.jbehave.scenario.steps; + +/** + * Represents the set of candidate steps that can be performed + */ +public interface CandidateSteps { + + CandidateStep[] getSteps(); + +}
Modified: trunk/jbehave-core/src/java/org/jbehave/scenario/steps/StepCreator.java (950 => 951)
--- trunk/jbehave-core/src/java/org/jbehave/scenario/steps/StepCreator.java 2008-09-28 15:25:43 UTC (rev 950) +++ trunk/jbehave-core/src/java/org/jbehave/scenario/steps/StepCreator.java 2008-09-28 16:33:06 UTC (rev 951) @@ -4,6 +4,6 @@ public interface StepCreator { - Step[] createStepsFrom(ScenarioDefinition scenario, Steps... candidateSteps); + Step[] createStepsFrom(ScenarioDefinition scenario, CandidateSteps... candidateSteps); }
Modified: trunk/jbehave-core/src/java/org/jbehave/scenario/steps/Steps.java (950 => 951)
--- trunk/jbehave-core/src/java/org/jbehave/scenario/steps/Steps.java 2008-09-28 15:25:43 UTC (rev 950) +++ trunk/jbehave-core/src/java/org/jbehave/scenario/steps/Steps.java 2008-09-28 16:33:06 UTC (rev 951) @@ -44,7 +44,7 @@ * elements, eg custom parameters converters. * </p> */ -public class Steps { +public class Steps implements CandidateSteps { private final StepsConfiguration configuration;
Modified: trunk/jbehave-core/src/java/org/jbehave/scenario/steps/UnmatchedToPendingStepCreator.java (950 => 951)
--- trunk/jbehave-core/src/java/org/jbehave/scenario/steps/UnmatchedToPendingStepCreator.java 2008-09-28 15:25:43 UTC (rev 950) +++ trunk/jbehave-core/src/java/org/jbehave/scenario/steps/UnmatchedToPendingStepCreator.java 2008-09-28 16:33:06 UTC (rev 951) @@ -5,11 +5,11 @@ public class UnmatchedToPendingStepCreator implements StepCreator { public Step[] createStepsFrom(ScenarioDefinition scenario, - Steps... candidateSteps) { + CandidateSteps... candidateSteps) { Step[] steps = new Step[scenario.getSteps().size()]; for (int i = 0; i < steps.length; i++) { String stringStep = scenario.getSteps().get(i); - for (Steps candidates : candidateSteps) { + for (CandidateSteps candidates : candidateSteps) { for (CandidateStep candidate : candidates.getSteps()) { if (candidate.matches(stringStep)) { steps[i] = candidate.createFrom(stringStep);
To unsubscribe from this list please visit: