Provide a method on Datatable to map to list of custom type
gaeljw opened this issue · 0 comments
gaeljw commented
Is your feature request related to a problem? Please describe.
Since version 6.x, we can benefit of extension methods to the Datatable class to map them to Scala collection types easily. But it assumes that we are converting only to basic types and always wrap the values in an Option.
This is not necessary for custom types registered with a DataTableType as we can assume that a scala DataTableType never returns null.
Describe the solution you'd like
We should be able to do map a Datatable to a list of custom types not wrapped in Option.
DataTableType { map: Map[String,String] =>
// map to CustomType
}
Given("the following table as Scala List of custom type") { (table: DataTable) =>
// We want this:
val data: Seq[CustomType] = table.asScalaRawList[CustomType]
// Instead of:
val data: Seq[Option[CustomType]] = table.asScalaList[CustomType]
// ...
}