Transformer doesn't convert "[empty]" values in the table to empty string ("")
See original GitHub issueDescribe the bug
Updated to version 6.10.0
recently and went through the documentation https://github.com/cucumber/cucumber-jvm-scala/blob/main/docs/transformers.md
but seems like none of the registered transformers for empty values in being used during the transformation. Not sure at what stage the transformer is called or if I’m doing something wrong.
Registered the transformer defined as:
DefaultDataTableCellTransformer("[empty]")((s: String, t: java.lang.reflect.Type) => {
new StringBuilder().append(s).append("-").append(t)
})
and can see it’s being registered (see attached screenshot) with glue but after transformation the DataTable
values are still coming out to be [empty]
.
To Reproduce Steps to reproduce the behavior.
Scenario: Test case 2, hotel with special condition
Given Hotels 419 checkin 2020-10-01 los 2
And BookingDate 2020-09-19 01:30:00
And GMTOffset +7
When The user search
Then The cancellation policy from search result should match following expected value
| RoomId | Promotion | Description | DefaultDescription | FreeCancellationDate | Title | Symbol |
| 1199923528 | - | [empty] | [empty] | 2020-09-19T00:00:00.000+07:00 | Cancellation policy | special-condition |
Step is defined as:
Then("""^The search result should match following expected value$""") { (dt: DataTable) =>
val result = parseResult(response, dataExtractors)
validateResult(dt, result)
}
Expected behavior
I expected the cells in features marked with [empty
would be converted to ""
against which result can be validated.
Versions:
- Cucumber Scala: [e.g. 6.10.0]
- Scala: [e.g. 2.12]
Additional context Add any other context about the problem here.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (6 by maintainers)
Top GitHub Comments
It would make sense for all
.asX
methods to invoke the transformer though, currently the difference between.asList(String.class)
and.asList()
is somewhat unexpected. We can do this on the next major version of Cucumber JVM.The transformers are only applied when the data table is converted into something else. The idea being that you use a list of transformed objects rather then a data table.
Or if you use it on a list of strings, that you use a list of strings instead.