Search in sources :

Example 1 with CucumberDocStringException

use of io.cucumber.docstring.CucumberDocStringException 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());
    }
}
Also used : CucumberDocStringException(io.cucumber.docstring.CucumberDocStringException) Argument(io.cucumber.core.stepexpression.Argument) ArrayList(java.util.ArrayList) ParameterInfo(io.cucumber.core.backend.ParameterInfo) CucumberExpressionException(io.cucumber.cucumberexpressions.CucumberExpressionException) CucumberInvocationTargetException(io.cucumber.core.backend.CucumberInvocationTargetException) UndefinedDataTableTypeException(io.cucumber.datatable.UndefinedDataTableTypeException) CucumberBackendException(io.cucumber.core.backend.CucumberBackendException) CucumberDataTableException(io.cucumber.datatable.CucumberDataTableException)

Aggregations

CucumberBackendException (io.cucumber.core.backend.CucumberBackendException)1 CucumberInvocationTargetException (io.cucumber.core.backend.CucumberInvocationTargetException)1 ParameterInfo (io.cucumber.core.backend.ParameterInfo)1 Argument (io.cucumber.core.stepexpression.Argument)1 CucumberExpressionException (io.cucumber.cucumberexpressions.CucumberExpressionException)1 CucumberDataTableException (io.cucumber.datatable.CucumberDataTableException)1 UndefinedDataTableTypeException (io.cucumber.datatable.UndefinedDataTableTypeException)1 CucumberDocStringException (io.cucumber.docstring.CucumberDocStringException)1 ArrayList (java.util.ArrayList)1