FasterXML / jackson-dataformat-xml

Extension for Jackson JSON processor that adds support for serializing POJOs as XML (and deserializing from XML) as an alternative to JSON
Apache License 2.0
567 stars 221 forks source link

Additional tests for string arrays and collections #586

Closed mbladel closed 1 year ago

mbladel commented 1 year ago

Following up on https://github.com/FasterXML/jackson-dataformat-xml/pull/585 with additional tests as suggested. I've added tests for POJOs with a string array or with a list, both are behaving as expected. I also added a test for a simple POJO with just plain string properties to be extra sure nothing breaks.

Regarding this comment:

Ok, this explicit comment makes me nervous: it specifically spells out that when asking from nextTextValue(), empty element should not be coerced into null

I was unsure about that comment too, but it looks like that particular token switch case XmlTokenStream.XML_END_ELEMENT only occurs for null string values (when xsi:nil writing and processing is enabled). The XmlTokenStream.XML_TEXT case is the one that gets triggered in all other cases as well as for empty strings.

cowtowncoder commented 1 year ago

@mbladel First of all, big thank you for these tests!

And yes, wrt null induction, I was wondering about the exact same thing. Conversion of xsi:nil is not well commented in code but I think your analysis is spot on. This assessment makes me much more confident in the solution.