[
http://jira.codehaus.org/browse/JBEHAVE-263?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mauro Talevi updated JBEHAVE-263:
---------------------------------
Description:
Right now the converters are called before running the scenario, which prevents
using stateful converters.
The parametrised step with the parameter conversion should be created lazily
upon invocation of the Step#perform() method.
was:
Right now the converters are called before running the scenario, which prevents
using stateful converters.
Here is an easy fix : change StepCreator#createParametrisedStep to the following
{code}
protected Step createParametrisedStep(final String stepAsString, final
Map<String, String> tableRow, final Matcher matcher, final Method method, final
StepMonitor stepMonitor, String[] groupNames) {
final Type[] types = method.getGenericParameterTypes();
final String[] annotationNames = annotatedParameterNames();
final String[] parameterNames = paranamer.lookupParameterNames(method,
false);
final String translatedStep = translatedStep(stepAsString, tableRow,
types, annotationNames, parameterNames);
return new Step() {
public StepResult perform() {
try {
stepMonitor.performing(stepAsString);
method.invoke(steps, argsForStep(tableRow, matcher, types,
annotationNames, parameterNames));
return
StepResult.success(stepAsString).withTranslatedText(translatedStep);
} catch (Throwable t) {
return failureWithOriginalException(stepAsString, t);
}
}
private StepResult failureWithOriginalException(final String
stepAsString, Throwable t) {
if (t instanceof InvocationTargetException && t.getCause() !=
null) {
if (t.getCause() instanceof PendingError) {
return StepResult.pending(stepAsString, (PendingError)
t.getCause());
} else {
return StepResult.failure(stepAsString, t.getCause());
}
}
return StepResult.failure(stepAsString, t);
}
public StepResult doNotPerform() {
return StepResult.notPerformed(stepAsString);
}
};
}
{code}
> Allow lazy parameter convertion
> -------------------------------
>
> Key: JBEHAVE-263
> URL: http://jira.codehaus.org/browse/JBEHAVE-263
> Project: JBehave
> Issue Type: Improvement
> Components: Core
> Affects Versions: 2.5
> Reporter: Bruno Bieth
> Fix For: 3.0
>
>
> Right now the converters are called before running the scenario, which
> prevents using stateful converters.
> The parametrised step with the parameter conversion should be created lazily
> upon invocation of the Step#perform() method.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email