@Override public void runStep(Scenario scenario) throws Throwable { int argumentCount = getArguments().size(); Integer parameterCount = stepDefinition.getParameterCount(); if (parameterCount != null && argumentCount != parameterCount) { throw arityMismatch(parameterCount); } List<Object> result = new ArrayList<>(); try { for (Argument argument : getArguments()) { result.add(argument.getValue()); } } catch (UndefinedDataTableTypeException e) { throw registerTypeInConfiguration(e); } catch (CucumberExpressionException | CucumberDataTableException e) { throw couldNotConvertArguments(e); } try { stepDefinition.execute(result.toArray(new Object[0])); } catch (CucumberException e) { throw e; } catch (Throwable t) { throw removeFrameworkFramesAndAppendStepLocation(t, getStepLocation()); } }
public ExecutionResult execute(UUID uuid, long id, StepDefinitionInvocation stepDefinitionInvocation) throws Throwable { SimpleGlue glue = glues.get(uuid); StepDefinition stepDefinition = glue.stepDefinition(id); LocalizedXStreams xStreams = new LocalizedXStreams(Thread.currentThread().getContextClassLoader()); try { String isoCode = stepDefinitionInvocation.getIsoCode(); I18n i18n = new I18n(isoCode); stepDefinition.execute(i18n, stepDefinitionInvocation.getArgs(xStreams.get(i18n.getLocale()), stepDefinition)); } catch (Exception e) { return new StepExecutionResult(e); } return new StepExecutionResult(); }