|
|
|
[
Permlink
| « Hide
]
Mauro Talevi - 19/Apr/05 03:21 PM
Applied. Thanks!
Isn't this kind of patch
- assertEquals(expected, xml); + assertEquals(xstream.fromXML(expected), obj); a bit unsafe? In the sense that it could "benefit" from a side effect/bug of the fromXML method to pass? Just my 2 cents, g Yes, it could "benefit" from bugs in fromXML(), but it works around the assumption that fields are returned in the same order as passed in during XML generation.
Basically these two following class definitions are the same and some of the XML based comparisons would treat them differently ... class A{ field B; field C; } class A{ field C; field B; } Do we have some other means to compare "object" XML for equivalency (ordering disregarded)? Thanks All you wanna ensure is the existence of the element:
Use an XPath expression! Yes XMLUnit would seem to address the ordering issues I seen. If XMLUnit will be included, I could correct the ordering issues in the tests.
Yes, sun.miscUnsafe is available. I run some fairly complex objects through, and didn't see issues. I'm happy to add XMLUnit to make the tests easier. This is something that has been discussed before, but at the time there was no overriding need. Looks like we have one now. If you can code up the code patch, I'll include XMLUnit when applying the patch.
cheers -Joe I submitted the XMLUnit patch as http://jira.codehaus.org/browse/XSTR-216
Mauro, you closed this originally, but a lot of unit tests still fail on IBM JDK, because of the different element order. Did you apply the patch? IMHO it is wong anyway to fix the test cases since it means that XML files genereated by XStream might be incompatible when generated by JDKs from different vendors.
XStream will now detect JVMs reporting the declared fields in reverse order (like IBM JDK). The fields will be written now in declaration order.
|
||||||||||||||||||||||||||||||||||||||||||||||||