use of cucumber.api.DataTable in project cucumber-jvm by cucumber.
the class TableConverterTest method converts_table_of_single_column_to_list_of_integers.
@Test
public void converts_table_of_single_column_to_list_of_integers() {
DataTable table = TableParser.parse("|3|\n|5|\n|6|\n|7|\n", null);
assertEquals(asList(3, 5, 6, 7), table.asList(Integer.class));
}
use of cucumber.api.DataTable in project cucumber-jvm by cucumber.
the class TableConverterTest method converts_distinct_tostring_objects_correctly.
@Test
public void converts_distinct_tostring_objects_correctly() {
DataTable table = TableParser.parse("|first|second|\n|row1.first|row1.second|\n|row2.first|row2.second|\n", null);
List<ContainsTwoFromStringableFields> converted = table.asList(ContainsTwoFromStringableFields.class);
List<ContainsTwoFromStringableFields> expected = Arrays.asList(new ContainsTwoFromStringableFields(new FirstFromStringable("row1.first"), new SecondFromStringable("row1.second")), new ContainsTwoFromStringableFields(new FirstFromStringable("row2.first"), new SecondFromStringable("row2.second")));
assertEquals(expected, converted);
}
use of cucumber.api.DataTable in project cucumber-jvm by cucumber.
the class TableConverterTest method converts_table_of_several_columns_to_list_of_integers.
@Test
public void converts_table_of_several_columns_to_list_of_integers() {
DataTable table = TableParser.parse("|3|5|\n|6|7|\n", null);
List<Integer> converted = table.asList(Integer.class);
assertEquals(asList(3, 5, 6, 7), converted);
}
use of cucumber.api.DataTable in project cucumber-jvm by cucumber.
the class TableConverterTest method converts_table_of_single_column_to_enums.
@Test
public void converts_table_of_single_column_to_enums() {
DataTable table = TableParser.parse("|RED|\n|GREEN|\n", null);
assertEquals(asList(Color.RED, Color.GREEN), table.asList(Color.class));
}
use of cucumber.api.DataTable in project cucumber-jvm by cucumber.
the class TableConverterTest method converts_to_list_of_map_of_date.
@Test
public void converts_to_list_of_map_of_date() {
DataTable table = TableParser.parse("|Birth Date|Death Cal|\n|1957-05-10|1979-02-02|\n", PARAMETER_INFO);
List<Map<String, Date>> converted = table.asMaps(String.class, Date.class);
assertEquals(sidsBirthday(), converted.get(0).get("Birth Date"));
}
Aggregations