Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

datatable-java: Header only datatable does not convert to empty list #537

Closed
lsuski opened this issue Nov 22, 2018 · 6 comments · Fixed by #540
Closed

datatable-java: Header only datatable does not convert to empty list #537

lsuski opened this issue Nov 22, 2018 · 6 comments · Fixed by #540
Labels
🐛 bug Defect / Bug library: datatables 🧷 pinned Tells Stalebot not to close this issue

Comments

@lsuski
Copy link
Contributor

lsuski commented Nov 22, 2018

Summary

In cucumber v2 header only datatables | firstName | lastName | birthDate | converts to empty list. In cucumber v4.2.0 there is exception thrown in such case.
This could have changed in be42d30. @mpkorstanje could you tell if this is really a bug or expected behaviour currently.
However converting List<Map<String, Integer>> in such case works.

Possible Solution

Change DataTableTypeRegistryTableConverter to handle this situation

@mpkorstanje
Copy link
Contributor

I'm having trouble working out why you'd get an error. Can you include the error, your step definition and your type registry configuration?

@lsuski
Copy link
Contributor Author

lsuski commented Nov 26, 2018

I'm using only default converters. Add this test to DataTableTypeRegistryTableConverterTest

 @Test
    public void convert_to_empty_list__only_header() {
        final DataTable table = parse("",
                                      " | firstName | lastName | birthDate |"
        );
        assertEquals(emptyList(), converter.convert(table, LIST_OF_AUTHOR));
    }

It fails although this test convert_to_empty_maps__only_header passes

@mpkorstanje
Copy link
Contributor

Cheers. That made it easy to spot. I'll have to think about the solution. It's a bit hard to explain.

@mpkorstanje
Copy link
Contributor

mpkorstanje commented Nov 26, 2018

What do you think of this? https://github.com/cucumber/cucumber/pull/540/files

Because of it convert_to_list_of_primitive will no longer works for tables that are too wide. Those couldn't ever be lists of primitives anyway. But we were doing it anyway. A behavior inherited from the original data table but undesirable in hindsight.

@lsuski
Copy link
Contributor Author

lsuski commented Nov 27, 2018

Looks good for me

@stale
Copy link

stale bot commented Feb 12, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week if no further activity occurs.

@stale stale bot added the ⌛ stale Will soon be closed by stalebot unless there is activity label Feb 12, 2019
@mpkorstanje mpkorstanje added the 🧷 pinned Tells Stalebot not to close this issue label Feb 12, 2019
@stale stale bot removed the ⌛ stale Will soon be closed by stalebot unless there is activity label Feb 12, 2019
@aslakhellesoy aslakhellesoy added the 🐛 bug Defect / Bug label Jun 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Defect / Bug library: datatables 🧷 pinned Tells Stalebot not to close this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants