-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Core: TableConverter extracts child object values but not headers #1049
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
Comments
Could be related to #1042 |
I'm not sure how to compile the fix to test it, but it sure looks like that could be it. |
If anyone seeing this knows of a workaround in the mean time, I'd be really interested! |
There are two bugs in here. One being that that ComplexTypeWriter goes out of alignment when dealing with nested complex types. E.g. The first will be fixed with #1042. The second will need some discussion. I reckon the proper way would be to use the string representation of {
a: "A",
b: {
b1: "B1",
b2: "B2",
toString() {
return this.b1 "-" + this.b2;
}
},
c: "C"
} | a | b | c |
| A | B1-B2 | C | When dealing with lists, dates and other basic types we'd need to use the existing converters. E.g: {
a: "A",
b: ["B1", "B2"]
c: "C"
} | a | b | c |
| A | B1, B2 | C | None of this seems to be supported by the current setup though. I'm that deeply into XStream. If anybody feels like figuring this out please do! |
As it turns out I was mistaken. To achieve the desired result you have to add a converter that tells Cucumber how to present your object in a table. This should also prevent any table imbalances. @XStreamConverter(TimeoDirectionConvertor::class)
data class TimeoDirection (var id: String, var name: String) {
override fun toString(): String = "$id - $name"
}
class TimeoDirectionConvertor : SingleValueConverter {
override fun toString(p0: Any?): String = p0.toString()
override fun fromString(p0: String?): Any = {
val (id, name) = p0!!.split(" - ");
TimeoDirection(id, name)
}
override fun canConvert(p0: Class<*>?): Boolean = TimeoDirection::class.java.isAssignableFrom(p0)
} |
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. |
Hi! I'd like to report a bug I encountered while trying out Cucumber on my freshly-converted Kotlin Android application. I'm not entirely sure if this is a bug with Cucumber or Kotlin, so I'll let you judge.
Steps to reproduce
nb: As you can see,
TimeoLine
contains aTimeoDirection
as a property nameddirection
DataTable.create()
on aList<TimeoLine>
Expected behavior
The function returns a table that looks like this:
Observed behavior
By playing a bit with the
DataTable
conversion, you'll seeComplexTypeWriter
extracts all the values in the object, including the members ofTimeoDirection
; but it only extracts the headers for the properties of the parent object (TimeoLine
). It also causes some not-failing-but-extremely-confusing-behavior in diffs.The text was updated successfully, but these errors were encountered: