本文整理汇总了Java中org.custommonkey.xmlunit.DetailedDiff.getAllDifferences方法的典型用法代码示例。如果您正苦于以下问题:Java DetailedDiff.getAllDifferences方法的具体用法?Java DetailedDiff.getAllDifferences怎么用?Java DetailedDiff.getAllDifferences使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.custommonkey.xmlunit.DetailedDiff
的用法示例。
在下文中一共展示了DetailedDiff.getAllDifferences方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assertModelEqualsFile
import org.custommonkey.xmlunit.DetailedDiff; //导入方法依赖的package包/类
protected void assertModelEqualsFile(String expectedPath) throws Exception {
File actualFile = tmpFolder.newFile();
Dmn.writeModelToFile(actualFile, modelInstance);
File expectedFile = ReflectUtil.getResourceAsFile(expectedPath);
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
Document actualDocument = docBuilder.parse(actualFile);
Document expectedDocument = docBuilder.parse(expectedFile);
Diff diff = new Diff(expectedDocument, actualDocument);
if (!diff.similar()) {
diff.overrideElementQualifier(new RecursiveElementNameAndTextQualifier());
DetailedDiff detailedDiff = new DetailedDiff(diff);
String failMsg = "XML differs:\n" + detailedDiff.getAllDifferences() + "\n\nActual XML:\n" + Dmn.convertToString(modelInstance);
fail(failMsg);
}
}
示例2: testDump
import org.custommonkey.xmlunit.DetailedDiff; //导入方法依赖的package包/类
@Test
public void testDump() throws IOException, SAXException {
Tags tags = new Tags();
tags.setTags(l);
String xml = xstream.toXML(tags);
InputStream in = null;
String content = null;
try {
in = getClass().getResourceAsStream("/Tags.xml");
content = IOUtils.toString(in);
} finally {
if (null != in) {
IOUtils.closeQuietly(in);
}
}
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setIgnoreAttributeOrder(true);
DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(content, xml));
List<?> allDifferences = diff.getAllDifferences();
Assert.assertEquals(allDifferences.size(), 0);
}
示例3: testDump
import org.custommonkey.xmlunit.DetailedDiff; //导入方法依赖的package包/类
@Test
public void testDump() throws IOException, SAXException {
TotalStat total = new TotalStat();
total.setStats(stats);
String xml = xstream.toXML(total);
InputStream in = null;
String content = null;
try {
in = getClass().getResourceAsStream("/TotalStat.xml");
content = IOUtils.toString(in);
} finally {
if (null != in) {
IOUtils.closeQuietly(in);
}
}
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setIgnoreAttributeOrder(true);
DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(content, xml));
List<?> allDifferences = diff.getAllDifferences();
Assert.assertEquals(allDifferences.size(), 0);
}
示例4: testDump
import org.custommonkey.xmlunit.DetailedDiff; //导入方法依赖的package包/类
@Test
public void testDump() throws IOException, SAXException {
Item item = new Item();
item.setName(name);
item.setContent(text);
String xml = xstream.toXML(item);
InputStream in = null;
String content = null;
try {
in = getClass().getResourceAsStream("/Item.xml");
content = IOUtils.toString(in);
} finally {
if (null != in) {
IOUtils.closeQuietly(in);
}
}
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setIgnoreAttributeOrder(true);
DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(content, xml));
List<?> allDifferences = diff.getAllDifferences();
Assert.assertEquals(allDifferences.size(), 0);
}
示例5: testDump
import org.custommonkey.xmlunit.DetailedDiff; //导入方法依赖的package包/类
@Test
public void testDump() throws IOException, SAXException {
Metadata metadata = new Metadata();
metadata.setItems(items);
String xml = xstream.toXML(metadata);
InputStream in = null;
String content = null;
try {
in = getClass().getResourceAsStream("/Metadata.xml");
content = IOUtils.toString(in);
} finally {
if (null != in) {
IOUtils.closeQuietly(in);
}
}
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setIgnoreAttributeOrder(true);
DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(content, xml));
List<?> allDifferences = diff.getAllDifferences();
Assert.assertEquals(allDifferences.size(), 0);
}
示例6: testDump
import org.custommonkey.xmlunit.DetailedDiff; //导入方法依赖的package包/类
@Test(dependsOnMethods = {"testLoad"})
public void testDump() throws IOException, SAXException {
String xml = xstream.toXML(robot);
InputStream in = null;
String content = null;
try {
in = getClass().getResourceAsStream("/Robot.xml");
content = IOUtils.toString(in);
} finally {
if (null != in) {
IOUtils.closeQuietly(in);
}
}
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setIgnoreAttributeOrder(true);
XMLUnit.setIgnoreDiffBetweenTextAndCDATA(true);
XMLUnit.setIgnoreComments(true);
DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(content, xml));
List<?> allDifferences = diff.getAllDifferences();
Assert.assertEquals(allDifferences.size(), 0, "Differences found: " + diff.toString());
}
示例7: testDump
import org.custommonkey.xmlunit.DetailedDiff; //导入方法依赖的package包/类
@Test(dependsOnMethods = {"testLoad"})
public void testDump() throws IOException, SAXException {
String xml = xstream.toXML(test);
InputStream in = null;
String content = null;
try {
in = getClass().getResourceAsStream("/Test.xml");
content = IOUtils.toString(in);
} finally {
if (null != in) {
IOUtils.closeQuietly(in);
}
}
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setIgnoreAttributeOrder(true);
DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(content, xml));
List<?> allDifferences = diff.getAllDifferences();
Assert.assertEquals(allDifferences.size(), 0);
}
示例8: testDump
import org.custommonkey.xmlunit.DetailedDiff; //导入方法依赖的package包/类
@Test
public void testDump() throws IOException, SAXException {
TagStat tagStat = new TagStat();
tagStat.setStats(Arrays.asList(new Stat[] {stat}));
String xml = xstream.toXML(tagStat);
InputStream in = null;
String content = null;
try {
in = getClass().getResourceAsStream("/TagStat.xml");
content = IOUtils.toString(in);
} finally {
if (null != in) {
IOUtils.closeQuietly(in);
}
}
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setIgnoreAttributeOrder(true);
DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(content, xml));
List<?> allDifferences = diff.getAllDifferences();
Assert.assertEquals(allDifferences.size(), 0);
}
示例9: testDump
import org.custommonkey.xmlunit.DetailedDiff; //导入方法依赖的package包/类
@Test
public void testDump() throws IOException, SAXException {
SuiteStat suiteStat = new SuiteStat();
suiteStat.setStats(stats);
String xml = xstream.toXML(suiteStat);
InputStream in = null;
String content = null;
try {
in = getClass().getResourceAsStream("/SuiteStat.xml");
content = IOUtils.toString(in);
} finally {
if (null != in) {
IOUtils.closeQuietly(in);
}
}
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setIgnoreAttributeOrder(true);
DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(content, xml));
List<?> allDifferences = diff.getAllDifferences();
Assert.assertEquals(allDifferences.size(), 0);
}
示例10: testDump
import org.custommonkey.xmlunit.DetailedDiff; //导入方法依赖的package包/类
@Test(dependsOnMethods = {"testLoad"})
public void testDump() throws IOException, SAXException {
String xml = xstream.toXML(statistics);
InputStream in = null;
String content = null;
try {
in = getClass().getResourceAsStream("/Statistics.xml");
content = IOUtils.toString(in);
} finally {
if (null != in) {
IOUtils.closeQuietly(in);
}
}
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setIgnoreAttributeOrder(true);
DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(content, xml));
List<?> allDifferences = diff.getAllDifferences();
Assert.assertEquals(allDifferences.size(), 0);
}
示例11: testDump
import org.custommonkey.xmlunit.DetailedDiff; //导入方法依赖的package包/类
@Test
public void testDump() throws IOException, SAXException {
Msg msg = new Msg();
msg.setTimestamp(new Date(0L));
msg.setLevel(l);
msg.setContent(c);
String xml = xstream.toXML(msg);
InputStream in = null;
String content = null;
try {
in = getClass().getResourceAsStream("/Msg.xml");
content = IOUtils.toString(in);
} finally {
if (null != in) {
IOUtils.closeQuietly(in);
}
}
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setIgnoreAttributeOrder(true);
DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(content, xml));
List<?> allDifferences = diff.getAllDifferences();
Assert.assertEquals(allDifferences.size(), 0);
}
示例12: evaluateDifferences
import org.custommonkey.xmlunit.DetailedDiff; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private List<Difference> evaluateDifferences(Diff diff, AbstractXmlDifferenceListener listener) {
LOGGER.trace("Comparison of XML started");
DetailedDiff d = new DetailedDiff(diff);
List<Difference> diffList;
try{
diffList = d.getAllDifferences();
}catch(RuntimeException e){//catch all exceptions to at least have some stacktrace and logging
LOGGER.error("Exception while retrieving SVG differences", e);
throw e;
}
LOGGER.debug("Comparison of XML finished; differences ignored: " +
((AbstractXmlDifferenceListener)listener).getNumberOfIgnoredDifferences() + "; accepted: " +
((AbstractXmlDifferenceListener)listener).getNumberOfAcceptedDifferences());
if (diffList != null)
return diffList;
else
return null;
}
示例13: getDifferences
import org.custommonkey.xmlunit.DetailedDiff; //导入方法依赖的package包/类
protected List<Difference> getDifferences(final String xmlA, final String xmlB) throws SAXException, IOException {
final DetailedDiff myDiff = new DetailedDiff(XMLUnit.compareXML(xmlA, xmlB));
final List<Difference> retDifferences = new ArrayList<Difference>();
@SuppressWarnings("unchecked")
final List<Difference> allDifferences = myDiff.getAllDifferences();
if (allDifferences.size() > 0) {
for (final Difference d : allDifferences) {
if (d.getDescription().equals("namespace URI")) {
LogUtils.infof(this, "Ignoring namspace difference: %s", d);
} else {
LogUtils.warnf(this, "Found difference: %s", d);
retDifferences.add(d);
}
}
}
return retDifferences;
}
示例14: assertXMLEquals
import org.custommonkey.xmlunit.DetailedDiff; //导入方法依赖的package包/类
public static void assertXMLEquals(String expectedXML, String actualXML) throws Exception {
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setIgnoreDiffBetweenTextAndCDATA(true);
XMLUnit.setIgnoreAttributeOrder(true);
DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(expectedXML, actualXML));
List<?> allDifferences = diff.getAllDifferences();
Assert.assertEquals("Differences found: "+ diff.toString(), 0, allDifferences.size());
}
示例15: assertXMLEquals
import org.custommonkey.xmlunit.DetailedDiff; //导入方法依赖的package包/类
private void assertXMLEquals(String expectedXML, String actualXML) throws SAXException, IOException {
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setIgnoreAttributeOrder(true);
XMLUnit.setNormalize(true);
DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(expectedXML, actualXML));
List<?> allDifferences = diff.getAllDifferences();
Assert.assertEquals("XML differences found: " + diff.toString(), 0, allDifferences.size());
}