Search in sources :

Example 1 with TableConverter

use of cucumber.runtime.table.TableConverter in project cucumber-jvm by cucumber.

the class StepDefinitionMatch method tableArgument.

private Object tableArgument(Step step, int argIndex, LocalizedXStreams.LocalizedXStream xStream) {
    ParameterInfo parameterInfo = getParameterType(argIndex, DataTable.class);
    TableConverter tableConverter = new TableConverter(xStream, parameterInfo);
    DataTable table = new DataTable(step.getRows(), tableConverter);
    Type type = parameterInfo.getType();
    return tableConverter.convert(table, type, parameterInfo.isTransposed());
}
Also used : DataTable(cucumber.api.DataTable) Type(java.lang.reflect.Type) TableConverter(cucumber.runtime.table.TableConverter)

Example 2 with TableConverter

use of cucumber.runtime.table.TableConverter in project cucumber-jvm by cucumber.

the class DataTable method create.

private static DataTable create(List<?> raw, Locale locale, String format, String... columnNames) {
    ParameterInfo parameterInfo = new ParameterInfo(null, format, null, null);
    TableConverter tableConverter = new TableConverter(new LocalizedXStreams(Thread.currentThread().getContextClassLoader()).get(locale), parameterInfo);
    return tableConverter.toTable(raw, columnNames);
}
Also used : TableConverter(cucumber.runtime.table.TableConverter) ParameterInfo(cucumber.runtime.ParameterInfo) LocalizedXStreams(cucumber.runtime.xstream.LocalizedXStreams)

Aggregations

TableConverter (cucumber.runtime.table.TableConverter)2 DataTable (cucumber.api.DataTable)1 ParameterInfo (cucumber.runtime.ParameterInfo)1 LocalizedXStreams (cucumber.runtime.xstream.LocalizedXStreams)1 Type (java.lang.reflect.Type)1