use of io.cucumber.core.backend.CucumberInvocationTargetException in project cucumber-jvm by cucumber.
the class PickleStepDefinitionMatch method runStep.
@Override
public void runStep(TestCaseState state) throws Throwable {
List<Argument> arguments = getArguments();
List<ParameterInfo> parameterInfos = stepDefinition.parameterInfos();
if (parameterInfos != null && arguments.size() != parameterInfos.size()) {
throw arityMismatch(parameterInfos.size());
}
List<Object> result = new ArrayList<>();
try {
for (Argument argument : arguments) {
result.add(argument.getValue());
}
} catch (UndefinedDataTableTypeException e) {
throw registerDataTableTypeInConfiguration(e);
} catch (CucumberExpressionException | CucumberDataTableException | CucumberDocStringException e) {
CucumberInvocationTargetException targetException;
if ((targetException = causedByCucumberInvocationTargetException(e)) != null) {
throw removeFrameworkFrames(targetException);
}
throw couldNotConvertArguments(e);
} catch (CucumberBackendException e) {
throw couldNotInvokeArgumentConversion(e);
} catch (CucumberInvocationTargetException e) {
throw removeFrameworkFrames(e);
}
try {
stepDefinition.execute(result.toArray(new Object[0]));
} catch (CucumberBackendException e) {
throw couldNotInvokeStep(e, result);
} catch (CucumberInvocationTargetException e) {
throw removeFrameworkFramesAndAppendStepLocation(e, getStepLocation());
}
}
Aggregations