use of gherkin.pickles.PickleString in project page-factory-2 by sbtqa.
the class DataReplacer method replacePickleArguments.
private void replacePickleArguments(PickleStepTestStep currentStep, boolean isStash) throws IllegalAccessException {
PickleStepTag pickleStepTag = (PickleStepTag) currentStep.getPickleStep();
for (gherkin.pickles.Argument argument : currentStep.getPickleStep().getArgument()) {
if (argument.getClass().equals(PickleTable.class)) {
replacePickleTable(pickleStepTag, (PickleTable) argument, isStash);
} else if (argument.getClass().equals(PickleString.class)) {
String content = replaceData(pickleStepTag, ((PickleString) argument).getContent(), isStash);
FieldUtils.writeField(argument, "content", content, true);
}
}
Object definitionMatchArguments = FieldUtils.readField(FieldUtils.readField(currentStep, "definitionMatch", true), "arguments", true);
if (definitionMatchArguments instanceof ArrayList) {
for (Object definitionMatchArgument : (ArrayList) definitionMatchArguments) {
if (definitionMatchArgument instanceof DataTableArgument) {
List<List<String>> newDefinitionMatchArgument = replaceDataTable(definitionMatchArgument, currentStep, isStash);
FieldUtils.writeField(definitionMatchArgument, "argument", newDefinitionMatchArgument, true);
} else if (definitionMatchArgument instanceof DocStringArgument) {
String newDefinitionMatchArgument = replaceData((PickleStepTag) currentStep.getPickleStep(), ((DocStringArgument) definitionMatchArgument).getValue().toString(), isStash);
FieldUtils.writeField(definitionMatchArgument, "argument", newDefinitionMatchArgument, true);
}
}
}
}
Aggregations