-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Errors in JacksonTableTransformer when adding both TableEntryByTypeTransformer and TableCellByTypeTransformer #1489
Comments
Owh very nice. Am I right in summarizing this as saying that with a data table converter configured for both options these scenario's should work?
|
Pretty much. Seems like TableEntryByTypeTransformer wins every time when both are added to typeregistry. Also when a setup (custom converters and all) which was working perfectly with cucumber-3 jars fails in cucumber-4 with the addition of just Jackson mapper code. This is mentioned above in the last paragraph of the 'Current Behavior' section.(Though i admit, have not been able to write that part clearly). This is strange and seems like in some cases Jackson mappers are having precedence over custom converters that are defined. |
Cheers. The precedence thing is a problem as shown by the first table. But without table cell converters the second table is ambiguous.
Looks the same as:
And at best the ambiguity can be resolved by leaving the top left empty. Then
|
Not sure if i agree to the point about modifying the table.
I get result as below -
|
Ah sorry. Should have said with both table cell converters and table entry converters the second table is ambiguous. The algorithm prefers the default table entry converter because it is generally more applicable to data tables then table cell converters. |
For example Jackson works with beans out of the box and headers make the table slightly more readable. |
Agreed that table should have headers to make it more readable and actually this example would be pretty rare if I dare to assume. |
Just to add on to the above, when I use the default Jackson mapper all my steps with DocString starts failing with the below error. |
In some scenarios default converters would be used when a defined converter was available. This was caused by returning a default converter as soon as no regular converter was available. This heuristic works well with two exceptions: * When the table contains a single line the default table entry transformer is never applicable * When the table keys don't imply a table entry the default table entry transformer is never applicable By inlining this lookup and working out the exceptions the old behaviour is restored. Fixes: cucumber/cucumber-jvm#1489 Fixes: cucumber/cucumber-jvm#1490
In some scenarios default converters would be used when a defined converter was available. This was caused by returning a default converter as soon as no regular converter was available. This heuristic works well with two exceptions: * When the table contains a single line the default table entry transformer is never applicable * When the table keys don't imply a table entry the default table entry transformer is never applicable By inlining this lookup and working out the exceptions the old behaviour is restored. Fixes: cucumber/cucumber-jvm#1489 Fixes: cucumber/cucumber-jvm#1490
In some scenarios default converters would be used when a defined converter was available. This was caused by returning a default converter as soon as no regular converter was available. This heuristic works well with two exceptions: * When the table contains a single line the default table entry transformer is never applicable * When the table keys don't imply a table entry the default table entry transformer is never applicable By inlining this lookup and working out the exceptions the old behaviour is restored. Fixes: cucumber/cucumber-jvm#1489 Fixes: cucumber/cucumber-jvm#1490
In some scenarios default converters would be used when a defined converter was available. This was caused by returning a default converter as soon as no regular converter was available. This heuristic works well with two exceptions: * When the table contains a single line the default table entry transformer is never applicable * When the table keys don't imply a table entry the default table entry transformer is never applicable By inlining this lookup and working out the exceptions the old behaviour is restored. Fixes: cucumber/cucumber-jvm#1489 Fixes: cucumber/cucumber-jvm#1490
@grasshopper7 Could you try building the snapshot from |
@mpkorstanje Everything works for all the initial scenarios. Also docstring issue of 1490 is working as before. Also fixed the ambiguous case, with no headers, when I use custom TableCellTransformer for the Map key and value. |
Cheers. v4.1.1 will be in central in a few hours. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
In some scenarios default converters would be used when a defined converter was available. This was caused by returning a default converter as soon as no regular converter was available. This heuristic works well with two exceptions: * When the table contains a single line the default table entry transformer is never applicable * When the table keys don't imply a table entry the default table entry transformer is never applicable By inlining this lookup and working out the exceptions the old behaviour is restored. Fixes: #1489 Fixes: #1490
Summary
Adding the default Jackson mapper as described here is causing erratic behaviour in DataTable conversion.
The feature file has a combination of scenarios which need both the TableEntryByTypeTransformer and TableCellByTypeTransformer to be added to the TypeRegistry in TypeRegistryConfigurer.
Custom cucumber 3 datatableconverters are commented out, anyways most of them are for this bigger feature file. This is the Runner class.
Expected Behavior
Addition of Jackson mapper should not fail existing datatable conversions.
Current Behavior
When the above code is commented out ie. no jackson mapper or custom converter, only the basic string scenarios work (Line 3 and 20) which is correct.
When the above code is NOT commented out then first three scenarios work (Line 3, 8 and 14). That is the ones which use TableEntryByTypeTransformer. It does not matter if the registry method lines (2 and 3) are switched. Get an error as below.
When line 3 is commented, that is TableEntryByTypeTransformer method is only present then similar result as above.
When line 2 is commented, that is TableCellByTypeTransformer method is only present then scenarios at Line 3,20 and 25 work. Get an error as below.
When the custom converters are NOT commented then also errors crop up for this feature file in certain cases. Works when jackson mapper is not present and when Line 2 ie TableEntryByTypeTransformer method is commented. Does not work when Line 3 ie. TableCellByTypeTransformer methodis commented or all the lines are NOT commented. Scenarios at line 20 and 25 fail.
Possible Solution
Commenting out the typeregistry default transformer setter methods one at a time works for certain cases and in summation all the scenarios are passing. Seems like on first failure an exception is thrown. Maybe need to check if any other transformertype is also present.
Steps to Reproduce (for bugs)
Use the Runner class.
Context & Motivation
Your Environment
The text was updated successfully, but these errors were encountered: