XMLUnit.setIgnoreWhitespace(true);
try {
DetailedDiff diffs = new DetailedDiff(XMLUnit.compareXML(expected, StubbedChannel.getOutput()));
List allDiffs = diffs.getAllDifferences();
assertEquals("Only expected 1 difference", 1, allDiffs.size());
Difference diff = (Difference) allDiffs.get(0);
String expectedDiffPath = "/Envelope[1]/Body[1]/Fault[1]/detail[1]/Exception[1]/text()[1]";
assertEquals("Expected difference to be at " + expectedDiffPath, expectedDiffPath, diff.getTestNodeDetail()
.getXpathLocation());
String expectedText = diff.getControlNodeDetail().getValue();
String actualText = diff.getTestNodeDetail().getValue();
assertTrue("Expected <Exception> element text to start with " + expectedText, actualText
.startsWith(expectedText));
String methodName = "testSendFaultOnExceptionWithStackTrace";
assertTrue("Expected <Exception> element text to include " + methodName + " in stack trace", actualText
.indexOf(methodName) != -1);