本文整理汇总了Java中org.custommonkey.xmlunit.Difference.isRecoverable方法的典型用法代码示例。如果您正苦于以下问题:Java Difference.isRecoverable方法的具体用法?Java Difference.isRecoverable怎么用?Java Difference.isRecoverable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.custommonkey.xmlunit.Difference
的用法示例。
在下文中一共展示了Difference.isRecoverable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: differenceFound
import org.custommonkey.xmlunit.Difference; //导入方法依赖的package包/类
public int differenceFound(Difference difference) {
//ignore dissimilarities
if (difference.isRecoverable())
{
return RETURN_ACCEPT_DIFFERENCE;
}
if ("${IGNORE}".equals(difference.getControlNodeDetail().getValue())) {
return RETURN_IGNORE_DIFFERENCE_NODES_SIMILAR;
}
else if (isDifferenceOnlyInAttributeValuePrefix(difference))
{
return RETURN_IGNORE_DIFFERENCE_NODES_SIMILAR;
}
else
{
return super.differenceFound(difference);
}
}
示例2: logUnrecoverableDifferences
import org.custommonkey.xmlunit.Difference; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private static void logUnrecoverableDifferences(DetailedDiff diff) {
for (Difference difference : (List<Difference>) diff.getAllDifferences()) {
if (!difference.isRecoverable()) {
LOG.error(difference.toString());
}
}
}
示例3: haltComparison
import org.custommonkey.xmlunit.Difference; //导入方法依赖的package包/类
/**
* Determine whether a Difference that this listener has been notified of
* should halt further XML comparison. This implementation halts
* if the Difference is not recoverable.
* @param afterDifference the last Difference passed to <code>differenceFound</code>
* @return false if the difference is recoverable, otherwise return true
*/
public boolean haltComparison(Difference afterDifference) {
if (afterDifference.isRecoverable()) {
return false;
}
return true;
}
示例4: compare
import org.custommonkey.xmlunit.Difference; //导入方法依赖的package包/类
public void compare ()
{
// Comparing
try {
output.println("Comparing " + controlFile + " to " + testFile);
final Document controlDoc;
final Document testDoc;
try (InputStream cis = new FileInputStream(controlFile)) {
controlDoc = new PositionalXMLReader().readXML(cis);
}
try (InputStream tis = new FileInputStream(testFile)) {
testDoc = new PositionalXMLReader().readXML(tis);
}
// Tuning
XMLUnit.setIgnoreDiffBetweenTextAndCDATA(true);
XMLUnit.setNormalizeWhitespace(true);
XMLUnit.setIgnoreWhitespace(true);
///XMLUnit.setIgnoreComments(true); NO!!!!!!!!
// The setIgnoreComments triggers the use of XSLT transform
// which 1/ ruins userdata and 2/ fails on xml:space and xml:lang.
// Moreover, comments are actually ignored by Diff
///XMLUnit.setCompareUnmatched(false); NO need
// Customization
Filter filter = (filterFile != null)
? new BasicFilter(new FileInputStream(filterFile))
: null;
Diff diff = new Diff(controlDoc, testDoc, null);
diff.overrideElementQualifier(
new ElementNameAndAttributeQualifier("number"));
diff.overrideDifferenceListener(
new MusicDifferenceListener(filter, output));
output.println("Similar: " + diff.similar());
output.println("Identical: " + diff.identical());
DetailedDiff detDiff = new DetailedDiff(diff);
List differences = detDiff.getAllDifferences();
output.println();
output.println("Physical differences: " + differences.size());
int diffId = 0;
for (Object object : differences) {
Difference difference = (Difference) object;
if (!difference.isRecoverable()
&& ((filter == null) || !filter.canIgnore(difference))) {
diffId++;
output.dump(diffId, difference);
}
}
output.println("Logical differences: " + diffId);
logger.info("Logical differences: {}", diffId);
} catch (ConfigurationException | SAXException | IOException e) {
e.printStackTrace();
}
}