- Revision
- 1220
- Author
- mauro
- Date
- 2009-09-05 05:20:58 -0500 (Sat, 05 Sep 2009)
Log Message
Configured use of step monitor in TraderSteps, which can be used to show how to trace the mechanism to find step args. Minor clean up of code.
Modified Paths
Diff
Modified: trunk/core/examples/trader/src/main/java/org/jbehave/examples/trader/TraderSteps.java (1219 => 1220)
--- trunk/core/examples/trader/src/main/java/org/jbehave/examples/trader/TraderSteps.java 2009-09-05 10:05:20 UTC (rev 1219) +++ trunk/core/examples/trader/src/main/java/org/jbehave/examples/trader/TraderSteps.java 2009-09-05 10:20:58 UTC (rev 1220) @@ -19,6 +19,7 @@ import org.jbehave.scenario.parser.PrefixCapturingPatternBuilder; import org.jbehave.scenario.steps.ParameterConverters; import org.jbehave.scenario.steps.SilentStepMonitor; +import org.jbehave.scenario.steps.StepMonitor; import org.jbehave.scenario.steps.Steps; import org.jbehave.scenario.steps.StepsConfiguration; @@ -30,9 +31,11 @@ public TraderSteps(ClassLoader classLoader) { super(configuration); - configuration.useParameterConverters(new ParameterConverters( - new SilentStepMonitor(), new TraderConverter(mockTradePersister()))); + StepMonitor monitor = new SilentStepMonitor(); + configuration.useParameterConverters(new ParameterConverters( + monitor, new TraderConverter(mockTradePersister()))); configuration.usePatternBuilder(new PrefixCapturingPatternBuilder("%")); + configuration.useMonitor(monitor); } private TraderPersister mockTradePersister() {
Modified: trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/CandidateStep.java (1219 => 1220)
--- trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/CandidateStep.java 2009-09-05 10:05:20 UTC (rev 1219) +++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/CandidateStep.java 2009-09-05 10:20:58 UTC (rev 1220) @@ -31,8 +31,9 @@ private final ParameterConverters parameterConverters; private final String[] startingWords; private final Pattern pattern; + private final String[] groupNames; + private StepMonitor stepMonitor = new SilentStepMonitor(); - private String[] groupNames; private Paranamer paranamer = new NullParanamer(); public CandidateStep(String stepAsString, Method method,
Modified: trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/PrintStreamStepMonitor.java (1219 => 1220)
--- trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/PrintStreamStepMonitor.java 2009-09-05 10:05:20 UTC (rev 1219) +++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/PrintStreamStepMonitor.java 2009-09-05 10:20:58 UTC (rev 1220) @@ -10,11 +10,16 @@ * {...@link System.out}. */ public class PrintStreamStepMonitor implements StepMonitor { + private static final String CONVERTED_VALUE_OF_TYPE = "Converted value ''{0}'' of type ''{1}'' to ''{2}'' with converter ''{3}''"; private static final String STEP_MATCHES_PATTERN = "Step ''{0}'' {1} pattern ''{2}''"; private static final String MATCHES = "matches"; private static final String DOES_NOT_MATCH = "does not match"; - private static final String USING_NAME_FOR_INDEX = "Using {0} name {1} for index {2}"; + private static final String USING_NAME_FOR_INDEX = "Using {0} name ''{1}'' for index {2}"; + private static final String ANNOTATED = "annotated"; + private static final String PARAMETER = "parameter"; + private static final String TABLE_ANNOTATED = "table annotated"; + private static final String TABLE_PARAMETER = "table parameter"; private static final String USING_NATURAL_ORDER_FOR_INDEX = "Using natural order for index {0}"; private static final String FOUND_ARG_FOR_INDEX = "Found argument ''{0}'' for index {1}"; @@ -46,22 +51,22 @@ } public void usingAnnotatedName(String name, int index) { - String message = format(USING_NAME_FOR_INDEX, "annotated", name, index); + String message = format(USING_NAME_FOR_INDEX, ANNOTATED, name, index); print(output, message); } public void usingParameterName(String name, int index) { - String message = format(USING_NAME_FOR_INDEX, "parameter", name, index); + String message = format(USING_NAME_FOR_INDEX, PARAMETER, name, index); print(output, message); } public void usingTableAnnotatedName(String name, int index) { - String message = format(USING_NAME_FOR_INDEX, "table annotated", name, index); + String message = format(USING_NAME_FOR_INDEX, TABLE_ANNOTATED, name, index); print(output, message); } public void usingTableParameterName(String name, int index) { - String message = format(USING_NAME_FOR_INDEX, "table parameter", name, index); + String message = format(USING_NAME_FOR_INDEX, TABLE_PARAMETER, name, index); print(output, message); }
To unsubscribe from this list please visit:
