use of gherkin.ast.DocString in project cucable-plugin by trivago.
the class GherkinToCucableConverter method convertGherkinStepsToCucableSteps.
/**
* Converts a list of Gherkin steps to Cucable steps including data tables.
*
* @param gherkinSteps a {@link Step} list.
* @return a {@link com.trivago.rta.vo.Step} list.
*/
List<com.trivago.rta.vo.Step> convertGherkinStepsToCucableSteps(final List<Step> gherkinSteps) {
List<com.trivago.rta.vo.Step> steps = new ArrayList<>();
for (Step gherkinStep : gherkinSteps) {
com.trivago.rta.vo.Step step;
com.trivago.rta.vo.DataTable dataTable = null;
String docString = null;
Node argument = gherkinStep.getArgument();
if (argument instanceof DataTable) {
dataTable = convertGherkinDataTableToCucumberDataTable((DataTable) argument);
} else if (argument instanceof DocString) {
docString = ((DocString) argument).getContent();
}
String keywordAndName = gherkinStep.getKeyword().concat(gherkinStep.getText());
step = new com.trivago.rta.vo.Step(keywordAndName, dataTable, docString);
steps.add(step);
}
return steps;
}
use of gherkin.ast.DocString in project page-factory-2 by sbtqa.
the class GherkinSerializer method buildStep.
private void buildStep(Step step) {
tab(2);
builder.append(step.getKeyword()).append(SPACE).append(step.getText());
if (step.getArgument() != null) {
nl(1);
if (step.getArgument() instanceof DataTable) {
DataTable table = (DataTable) step.getArgument();
table.getRows().forEach(this::buildTableRow);
} else if (step.getArgument() instanceof DocString) {
tab(2);
builder.append("\"\"\"");
nl(1);
DocString docString = (DocString) step.getArgument();
tab(2);
builder.append(docString.getContent());
nl(1);
tab(2);
builder.append("\"\"\"");
nl(1);
}
} else {
builder.append("\n");
}
}
use of gherkin.ast.DocString in project cucable-plugin by trivago.
the class GherkinToCucableConverter method convertGherkinStepsToCucableSteps.
/**
* Converts a list of Gherkin steps to Cucable steps including data tables.
*
* @param gherkinSteps a {@link Step} list.
* @return a {@link com.trivago.vo.Step} list.
*/
List<com.trivago.vo.Step> convertGherkinStepsToCucableSteps(final List<Step> gherkinSteps) {
List<com.trivago.vo.Step> steps = new ArrayList<>();
for (Step gherkinStep : gherkinSteps) {
com.trivago.vo.Step step;
com.trivago.vo.DataTable dataTable = null;
String docString = null;
Node argument = gherkinStep.getArgument();
if (argument instanceof DataTable) {
dataTable = convertGherkinDataTableToCucableDataTable((DataTable) argument);
} else if (argument instanceof DocString) {
docString = ((DocString) argument).getContent();
}
String keywordAndName = gherkinStep.getKeyword().concat(gherkinStep.getText());
step = new com.trivago.vo.Step(keywordAndName, dataTable, docString);
steps.add(step);
}
return steps;
}