Add TypeMatcher in xmlunit-matchers#137
Conversation
bodewig
left a comment
There was a problem hiding this comment.
Many thanks, looks good.
I'm not totally sure about accepting 0/1 as booleans, one could argue that it should also accept on/off or something similar.
We may want to extend this with a TypeMatcher<Date> later.
|
Using 1/0 as true/false is natural in C/C++ or, at least it was, when I used those languages few years ago. |
|
You might also consider following information: In XML Schema 1.0 a boolean can be one of these: true, false, 1 or 0. See https://www.w3.org/TR/xmlschema-2/#boolean . In XML Schema 1.1 this Issue is "fixed" https://www.w3.org/TR/xmlschema11-2/#boolean I also believe prior to SOAP 1.2 XML Schema 1.0 is used. Quite a few SOAP-Services should accept 1 and 0 as valid boolean values. So you could argue that it still is quite common. I personally think 1/0 is nowadays a bad practice and should be avoided. |
|
Ok, to be consistent I also removed 0/1 to boolean conversion from assertj module |
|
we may want to note this as a breaking change inside the AsserJ module. |
TypeMatcher allows to check if an examined string value can be converted to specified type and perform matching on the converted value.
For now 4 types are support: BigDecimal, Double, Integer and Boolean
This feature is response on #133 and works well with
EvaluateXPathMatcher: