- Revision
- 1371
- Author
- mauro
- Date
- 2009-10-31 09:45:30 -0500 (Sat, 31 Oct 2009)
Log Message
Renamed candidate step variable and method to avoid confusion between step pattern and textual step
Modified Paths
Diff
Modified: trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/CandidateStep.java (1370 => 1371)
--- trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/CandidateStep.java 2009-10-30 09:56:50 UTC (rev 1370) +++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/CandidateStep.java 2009-10-31 14:45:30 UTC (rev 1371) @@ -18,7 +18,8 @@ import com.thoughtworks.paranamer.Paranamer; /** - * Creates candidate step from its string representation + * Creates candidate step from a regex pattern of a step of a given type, + * associated to a Java method. * * @author Elizabeth Keogh * @author Mauro Talevi @@ -26,7 +27,7 @@ */ public class CandidateStep { - private final String stepAsString; + private final String patternAsString; private final StepType stepType; private final Method method; private final CandidateSteps steps; @@ -38,18 +39,18 @@ private StepMonitor stepMonitor = new SilentStepMonitor(); private Paranamer paranamer = new NullParanamer(); - public CandidateStep(String stepAsString, StepType stepType, Method method, + public CandidateStep(String patternAsString, StepType stepType, Method method, CandidateSteps steps, StepPatternBuilder patternBuilder, ParameterConverters parameterConverters, Map<StepType, String> startingWords) { - this.stepAsString = stepAsString; + this.patternAsString = patternAsString; this.stepType = stepType; this.method = method; this.steps = steps; this.parameterConverters = parameterConverters; this.startingWordsByType = startingWords; - this.pattern = patternBuilder.buildPattern(stepAsString); - this.groupNames = patternBuilder.extractGroupNames(stepAsString); + this.pattern = patternBuilder.buildPattern(patternAsString); + this.groupNames = patternBuilder.extractGroupNames(patternAsString); } public void useStepMonitor(StepMonitor stepMonitor) { @@ -248,8 +249,8 @@ return stepType; } - public String getStepAsString() { - return stepAsString; + public String getPatternAsString() { + return patternAsString; } public Pattern getPattern() { @@ -258,7 +259,7 @@ @Override public String toString() { - return stepAsString; + return patternAsString; } @SuppressWarnings("serial")
Modified: trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/Steps.java (1370 => 1371)
--- trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/Steps.java 2009-10-30 09:56:50 UTC (rev 1370) +++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/Steps.java 2009-10-31 14:45:30 UTC (rev 1371) @@ -155,9 +155,9 @@ } private void createCandidateStep(List<CandidateStep> steps, Method method, - StepType stepType, String stepAsString) { - checkForDuplicateCandidateSteps(steps, stepType, stepAsString); - CandidateStep step = new CandidateStep(stepAsString, stepType, method, + StepType stepType, String stepPatternAsString) { + checkForDuplicateCandidateSteps(steps, stepType, stepPatternAsString); + CandidateStep step = new CandidateStep(stepPatternAsString, stepType, method, this, configuration.getPatternBuilder(), configuration .getParameterConverters(), configuration .getStartingWordsByType()); @@ -167,10 +167,10 @@ } private void checkForDuplicateCandidateSteps(List<CandidateStep> steps, - StepType stepType, String stepAsString) { + StepType stepType, String patternAsString) { for (CandidateStep step : steps) { - if (step.getStepType() == stepType && step.getStepAsString().equals(stepAsString)) { - throw new DuplicateCandidateStepFoundException(stepType, stepAsString); + if (step.getStepType() == stepType && step.getPatternAsString().equals(patternAsString)) { + throw new DuplicateCandidateStepFoundException(stepType, patternAsString); } } } @@ -296,8 +296,8 @@ public static class DuplicateCandidateStepFoundException extends RuntimeException { - public DuplicateCandidateStepFoundException(StepType stepType, String stepAsString) { - super(stepType+" "+stepAsString); + public DuplicateCandidateStepFoundException(StepType stepType, String patternAsString) { + super(stepType+" "+patternAsString); } }
To unsubscribe from this list please visit:
