I have two scala.xml.Elem objects (actual, expected). I am using JUnit 4, but have also included XMLUnit 1.3.
Is there any easy way to compare the two objects for equality, ignoring attribute order and insignificant whitespace in the XML?
I tried XMLUnit.assertXMLEqual(), but it complains that the types are scala.xml.Elem.
I know that I can use equals or ==, but I would like the benefit of having the assertion print the two values when they are not equal. If I use assertTrue(actual.equals(expected)), and they are not equal, the only output will be “assertion failed”.
Use the version of
assertTruethat allows passing custom messagesand (for example)
diffto produce the string with the descendand nodes that aren’t equal