Search in sources :

Example 1 with DocStringArgument

use of io.cucumber.core.gherkin.DocStringArgument in project cucumber-jvm by cucumber.

the class ArgumentMatcher method argumentsFrom.

public List<Argument> argumentsFrom(Step step, Type... types) {
    io.cucumber.core.gherkin.Argument arg = step.getArgument();
    if (arg == null) {
        return expression.match(step.getText(), types);
    }
    if (arg instanceof io.cucumber.core.gherkin.DocStringArgument) {
        DocStringArgument docString = (DocStringArgument) arg;
        String content = docString.getContent();
        String contentType = docString.getMediaType();
        return expression.match(step.getText(), content, contentType, types);
    }
    if (arg instanceof io.cucumber.core.gherkin.DataTableArgument) {
        DataTableArgument table = (DataTableArgument) arg;
        List<List<String>> cells = emptyCellsToNull(table.cells());
        return expression.match(step.getText(), cells, types);
    }
    throw new IllegalStateException("Argument was neither PickleString nor PickleTable");
}
Also used : DataTableArgument(io.cucumber.core.gherkin.DataTableArgument) List(java.util.List) DocStringArgument(io.cucumber.core.gherkin.DocStringArgument)

Aggregations

DataTableArgument (io.cucumber.core.gherkin.DataTableArgument)1 DocStringArgument (io.cucumber.core.gherkin.DocStringArgument)1 List (java.util.List)1