XMLUnit尝试匹配正确的Entity元素(即具有正确的属性),但是获得actual-<“null”>,expected-<“null”> <“Entity”不匹配>节点名。
String expected = "<Object>" +
"<Entity id=\"Entity1\">" +
"expected1" +
"</Entity>" +
"<Entity id=\"Entity2\">" +
"expected2" +
"</Entity>" +
"</Object>";
String actual = "<Object>" +
"<Entity id=\"Entity2\">" +
"expected2" +
"</Entity>" +
"<Entity id=\"Entity1\">" +
"expected1" +
"</Entity>" +
"</Object>";
这是什么问题? 提前谢谢!
答案 0 :(得分:0)
与节点顺序有关。很难找到最终输出的不匹配细节。但我能够看到DifferenceListener.differenceFound(Difference difference)
。我们可以通过捕捉DifferenceConstances.CHILD_NODELIST_SEQUENCE_ID
即return DifferenceListener.RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL;