I want two compare two xmls. SetNormalizeWhitespace is true and:
- expected is <name>value</tag>
- actual is <name> value</tag>
Should my test fail? As I understand comparison should work like this " value" is different from "value".
And even with whitespace normalization because this should only change few white spaces to one.
Thanks
Waldemar
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
SetNormalizeWhitespace(true) implies DocumentBuilder.setIgnoringElementContentWhitespace(true) but I wouldn't expect this to affect whitespace between the opening element and the non-whitespace text content.
I assume it passes or otherwise you wouldn't be asking this question, right?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello
I want two compare two xmls. SetNormalizeWhitespace is true and:
- expected is <name>value</tag>
- actual is <name> value</tag>
Should my test fail? As I understand comparison should work like this " value" is different from "value".
And even with whitespace normalization because this should only change few white spaces to one.
Thanks
Waldemar
Yes, you should expect your test to fail.
SetNormalizeWhitespace(true) implies DocumentBuilder.setIgnoringElementContentWhitespace(true) but I wouldn't expect this to affect whitespace between the opening element and the non-whitespace text content.
I assume it passes or otherwise you wouldn't be asking this question, right?
Well, it's only been a year or so since I implemented it and I forgot how I did.
If you set normalizeWhitespace to true, XMLUnit will trim all text content - and the user guide actually says so. See http://xmlunit.sourceforge.net/userguide/html/ar01s03.html#Comparing:%20Configuration
So, sorry for the confusion: you should expect the values to be identical. Testcase removed and Javadocs modified to mention the fact.
http://xmlunit.svn.sourceforge.net/viewvc/xmlunit?view=rev&revision=251 fails, I opened issue 1917796 for it.
Yes, it fails :)
Thanks