Skip to content

Commit ac58b73

Browse files
committed
Merge branch 'fix_tables_with_nulls' of https://github.com/gphilipp/cucumber-jvm into gphilipp-fix_tables_with_nulls
2 parents 86683a2 + fad860a commit ac58b73

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

core/src/test/java/cucumber/table/ToDataTableTest.java

+19
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,17 @@ public void converts_list_of_beans_to_table() {
4242
"", table.toString());
4343
}
4444

45+
@Test
46+
public void converts_list_of_beans_with_null_to_table() {
47+
List<UserPojo> users = tc.toList(UserPojo.class, personTableWithNull());
48+
DataTable table = tc.toTable(users);
49+
assertEquals("" +
50+
" | credits | name | birthDate |\n" +
51+
" | 1,000 | Sid Vicious | |\n" +
52+
" | 3,000 | Frank Zappa | 21/12/1940 |\n" +
53+
"", table.toString());
54+
}
55+
4556
@Test
4657
public void gives_a_nice_error_message_when_field_is_missing() {
4758
try {
@@ -102,6 +113,14 @@ private DataTable personTable() {
102113
"");
103114
}
104115

116+
private DataTable personTableWithNull() {
117+
return TableParser.parse("" +
118+
"| name | birthDate | credits |\n" +
119+
"| Sid Vicious | | 1,000 |\n" +
120+
"| Frank Zappa | 21/12/1940 | 3,000 |\n" +
121+
"");
122+
}
123+
105124
@Test
106125
public void converts_list_of_single_value_to_table() {
107126
List<? extends List<? extends Number>> lists = asList(asList(0.5, 1.5), asList(99.0, 1000.5));

0 commit comments

Comments
 (0)