xmlunit
xmlunit copied to clipboard
Possible to Ignore element by name using XmlAssert of the xmlunit-assertj3 module?
Hi
Is it possible to specify elements to ignore when comparing xml using assertj 3?
assertThat(createTestDocument())
.and(Input.fromFile("test-data/good.xml"))
.ignoringElements("foo", "bar")
.areIdentical();
Thanks
Ben
withNodeFilter is what you are looking for. Something like
.withNodeFilter(n -> !(n instanceof Element && ("foo".equals(n.getLocalName()) || "foo".equals(n.getNodeName())))