use of io.cucumber.datatable.DataTable in project cucumber-jvm by cucumber.
the class JavaDataTableTypeDefinition method createDataTableType.
private DataTableType createDataTableType(Method method) {
Type returnType = requireValidReturnType(method);
Type parameterType = requireValidParameterType(method);
if (DataTable.class.equals(parameterType)) {
return new DataTableType(returnType, (DataTable table) -> invokeMethod(replaceEmptyPatternsWithEmptyString(table)));
}
if (List.class.equals(parameterType)) {
return new DataTableType(returnType, (List<String> row) -> invokeMethod(replaceEmptyPatternsWithEmptyString(row)));
}
if (Map.class.equals(parameterType)) {
return new DataTableType(returnType, (Map<String, String> entry) -> invokeMethod(replaceEmptyPatternsWithEmptyString(entry)));
}
if (String.class.equals(parameterType)) {
return new DataTableType(returnType, (String cell) -> invokeMethod(replaceEmptyPatternsWithEmptyString(cell)));
}
throw createInvalidSignatureException(method);
}
Aggregations