use of io.cucumber.stepexpression.Argument in project page-factory-2 by sbtqa.
the class CriticalStepAspect method argumentOffset.
@Around(value = "argumentOffset(arguments, stepDefinition, featurePath, step)", argNames = "joinPoint,arguments,stepDefinition,featurePath,step")
public Object argumentOffset(ProceedingJoinPoint joinPoint, List<Argument> arguments, StepDefinition stepDefinition, String featurePath, PickleStep step) throws Throwable {
for (Argument argument : arguments) {
if (argument instanceof ExpressionArgument && hasReplaceableArgument(step, argument)) {
int start = ((ExpressionArgument) argument).getGroup().getStart();
int end = ((ExpressionArgument) argument).getGroup().getEnd();
int offset = NON_CRITICAL.length();
FieldUtils.writeField(FieldUtils.readField(FieldUtils.readField(argument, "argument", true), "group", true), "start", start + offset, true);
FieldUtils.writeField(FieldUtils.readField(FieldUtils.readField(argument, "argument", true), "group", true), "end", end + offset, true);
}
}
return joinPoint.proceed();
}
Aggregations