private void assertXmlPayload(RestTest restTest, com.jcabi.http.Response response) {
        InputStream inputStream = null;
        try {
            inputStream = new ByteArrayInputStream(response.binary());
            StringWriter writer = new StringWriter();
            IOUtils.copy(inputStream, writer);
            String xmlPayload = writer.toString();
            String expectedPayload = TestUtil.doPropertyReplacement(restTest.getExpectedResponsePayload());
            Assert.assertNotNull("REST Test missing expected XML payload.", expectedPayload);
            try {
                XMLUnit.setIgnoreComments(true);
                XMLUnit.setIgnoreAttributeOrder(true);
                XMLUnit.setIgnoreWhitespace(true);
                XMLUnit.setIgnoreDiffBetweenTextAndCDATA(true);
                XMLUnit.setCompareUnmatched(false);
                Diff diff = new Diff(expectedPayload, xmlPayload);
                // A custom element qualifier allows us to customize how the diff engine
                // compares the XML nodes. In this case, we're specially handling any
                // elements named "entry" so that we can compare the standard XML format
                // of the Echo API we use for most of our tests. The format of an
                // entry looks like:
                // <entry>
                // <key>Name</key>
                // <value>Value</value>
                // </entry>
                diff.overrideElementQualifier(new ElementNameQualifier() {
                    @Override
                    public boolean qualifyForComparison(Element control, Element test) {
                        if (control == null || test == null) {
                            return super.qualifyForComparison(control, test);
                        }
                        if (control.getNodeName().equals("entry") && test.getNodeName().equals("entry")) {
                            String controlKeyName = control.getElementsByTagName("key").item(0).getTextContent();
                            String testKeyName = test.getElementsByTagName("key").item(0).getTextContent();
                            return controlKeyName.equals(testKeyName);
                        }
                        return super.qualifyForComparison(control, test);
                    }
                });
                diff.overrideDifferenceListener(new DifferenceListener() {
                    @Override
                    public void skippedComparison(Node control, Node test) {
                    }

                    @Override
                    public int differenceFound(Difference difference) {
                        String value = difference.getControlNodeDetail().getValue();
                        String tvalue = null;
                        if (difference.getControlNodeDetail().getNode() != null) {
                            tvalue = difference.getControlNodeDetail().getNode().getTextContent();
                        }
                        if ("*".equals(value) || "*".equals(tvalue)) {
                            return RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL;
                        } else {
                            return RETURN_ACCEPT_DIFFERENCE;
                        }
                    }
                });
                XMLAssert.assertXMLEqual(null, diff, true);
            } catch (Error e) {
                System.out.println("--- START FAILED XML PAYLOAD ---");
                System.out.println(xmlPayload);
                System.out.println("--- END FAILED XML PAYLOAD ---");
                throw e;
            }
        } catch (Exception e) {
            throw new Error(e);
        } finally {
            IOUtils.closeQuietly(inputStream);
        }
    }
The payload is expected to be XML. Parse it and then use XmlUnit to compare the payload
with the expected payload (obviously also XML).

@param restTest
@param response
test/common/src/main/java/io/apiman/test/common/util/TestPlanRunner.java