当前位置: 首页>>代码示例>>Java>>正文


Java DetailedDiff.getAllDifferences方法代码示例

本文整理汇总了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);
  }
}
 
开发者ID:camunda,项目名称:camunda-dmn-model,代码行数:20,代码来源:DmnModelTest.java

示例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);
}
 
开发者ID:jrobotframework,项目名称:jrobotframework-report,代码行数:23,代码来源:TagsTest.java

示例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);
}
 
开发者ID:jrobotframework,项目名称:jrobotframework-report,代码行数:23,代码来源:TotalStatTest.java

示例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);
}
 
开发者ID:jrobotframework,项目名称:jrobotframework-report,代码行数:24,代码来源:ItemTest.java

示例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);
}
 
开发者ID:jrobotframework,项目名称:jrobotframework-report,代码行数:23,代码来源:MetadataTest.java

示例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());
}
 
开发者ID:jrobotframework,项目名称:jrobotframework-report,代码行数:23,代码来源:RobotTest.java

示例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);
}
 
开发者ID:jrobotframework,项目名称:jrobotframework-report,代码行数:21,代码来源:TestTest.java

示例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);
}
 
开发者ID:jrobotframework,项目名称:jrobotframework-report,代码行数:23,代码来源:TagStatTest.java

示例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);
}
 
开发者ID:jrobotframework,项目名称:jrobotframework-report,代码行数:23,代码来源:SuiteStatTest.java

示例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);
}
 
开发者ID:jrobotframework,项目名称:jrobotframework-report,代码行数:21,代码来源:StatisticsTest.java

示例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);
}
 
开发者ID:jrobotframework,项目名称:jrobotframework-report,代码行数:25,代码来源:MsgTest.java

示例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;
}
 
开发者ID:bpmn-miwg,项目名称:bpmn-miwg-tools,代码行数:21,代码来源:XmlDiffUtil.java

示例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;
  }
 
开发者ID:vishwaabhinav,项目名称:OpenNMS,代码行数:18,代码来源:XmlTest.java

示例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());
}
 
开发者ID:hashmapinc,项目名称:WitsmlObjectsLibrary,代码行数:11,代码来源:TestUtilities.java

示例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());
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:9,代码来源:DLNAServiceTest.java


注:本文中的org.custommonkey.xmlunit.DetailedDiff.getAllDifferences方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。