Only first difference is printed in assertion error when xml comparison is failed. For example comparison of two xmls:

<root><a>a</a><b>b</b></root>

and

<root><b>b</b><c>c</c></root>

fails with message Body content Expected child 'a' but was 'null' - comparing <a...> at /root[1]/a[1] to <NULL>. There is nothing about child c in this message.

That is a strange behaviour of a xml-unit and it was updated with https://github.com/xmlunit/xmlunit/issues/232

To fail with full diff description we should use fullDescription() method instead of toString() on Diff class.

With the full description fail message would be:

Body content Expected child 'a' but was 'null' - comparing <a...> at /root[1]/a[1] to <NULL>
Expected child 'null' but was 'c' - comparing <NULL> to <c...> at /root[1]/c[1]

Full description is better for bug fixing.

Comment From: pivotal-cla

@Boiarshinov Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

Comment From: pivotal-cla

@Boiarshinov Thank you for signing the Contributor License Agreement!

Comment From: sbrannen

This has been merged into 6.2.x and main, for inclusion in Spring Framework 6.2.1.

Thanks 👍