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


Java DetailedDiff类代码示例

本文整理汇总了Java中org.custommonkey.xmlunit.DetailedDiff的典型用法代码示例。如果您正苦于以下问题:Java DetailedDiff类的具体用法?Java DetailedDiff怎么用?Java DetailedDiff使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DetailedDiff类属于org.custommonkey.xmlunit包,在下文中一共展示了DetailedDiff类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: assertMetadataEquals

import org.custommonkey.xmlunit.DetailedDiff; //导入依赖的package包/类
private void assertMetadataEquals( String expectedMetadataXml, File actualFile )
    throws Exception
{
    assertNotNull( "Actual File should not be null.", actualFile );

    assertTrue( "Actual file exists.", actualFile.exists() );

    StringWriter actualContents = new StringWriter();
    ArchivaRepositoryMetadata metadata = MavenMetadataReader.read( actualFile );
    RepositoryMetadataWriter.write( metadata, actualContents );

    DetailedDiff detailedDiff = new DetailedDiff( new Diff( expectedMetadataXml, actualContents.toString() ) );
    if ( !detailedDiff.similar() )
    {
        assertEquals( expectedMetadataXml, actualContents );
    }

    // assertEquals( "Check file contents.", expectedMetadataXml, actualContents );
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:20,代码来源:MetadataTransferTest.java

示例2: writeDeliverResponse

import org.custommonkey.xmlunit.DetailedDiff; //导入依赖的package包/类
@Test
public void writeDeliverResponse() throws Exception {
    DeliverResponse deliverResponse = new DeliverResponse();
    deliverResponse.setErrorCode(5);
    deliverResponse.setErrorMessage("Success");

    StringWriter sw = new StringWriter();
    SxmpWriter.write(sw, deliverResponse);

    logger.debug(sw.toString());

    StringBuilder expectedXML = new StringBuilder(200)
        .append("<?xml version=\"1.0\"?>\n")
        .append("<operation type=\"deliver\">\n")
        .append(" <deliverResponse>\n")
        .append("   <error code=\"5\" message=\"Success\"/>\n")
        .append(" </deliverResponse>\n")
        .append("</operation>\n")
        .append("");

    // compare to actual correct submit response
    XMLUnit.setIgnoreWhitespace(true);
    Diff myDiff = new Diff(expectedXML.toString(), sw.toString());
    DetailedDiff myDetailedDiff = new DetailedDiff(myDiff);
    Assert.assertTrue("XML are similar " + myDetailedDiff, myDetailedDiff.similar());
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:27,代码来源:SxmpWriterTest.java

示例3: writeDeliveryReportResponse

import org.custommonkey.xmlunit.DetailedDiff; //导入依赖的package包/类
@Test
public void writeDeliveryReportResponse() throws Exception {
    DeliveryReportResponse deliveryResponse = new DeliveryReportResponse();
    deliveryResponse.setErrorCode(5);
    deliveryResponse.setErrorMessage("Success");

    StringWriter sw = new StringWriter();
    SxmpWriter.write(sw, deliveryResponse);

    logger.debug(sw.toString());

    StringBuilder expectedXML = new StringBuilder(200)
        .append("<?xml version=\"1.0\"?>\n")
        .append("<operation type=\"deliveryReport\">\n")
        .append(" <deliveryReportResponse>\n")
        .append("   <error code=\"5\" message=\"Success\"/>\n")
        .append(" </deliveryReportResponse>\n")
        .append("</operation>\n")
        .append("");

    // compare to actual correct submit response
    XMLUnit.setIgnoreWhitespace(true);
    Diff myDiff = new Diff(expectedXML.toString(), sw.toString());
    DetailedDiff myDetailedDiff = new DetailedDiff(myDiff);
    Assert.assertTrue("XML are similar " + myDetailedDiff, myDetailedDiff.similar());
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:27,代码来源:SxmpWriterTest.java

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: testDump

import org.custommonkey.xmlunit.DetailedDiff; //导入依赖的package包/类
@Test
public void testDump() throws IOException, SAXException {
    Stat stat = new Stat();
    stat.setPass(pass);
    stat.setFail(fail);
    stat.setName(name);
    stat.setId(id);
    stat.setContent(content);
    String xml = xstream.toXML(stat);
    InputStream in = null;
    String str = null;
    try {
        in = getClass().getResourceAsStream("/Stat.xml");
        str = IOUtils.toString(in);
    } finally {
        if (null != in) {
            IOUtils.closeQuietly(in);
        }
    }
    XMLUnit.setIgnoreWhitespace(true);
    XMLUnit.setIgnoreAttributeOrder(true);

    DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(str, xml));
    List<?> allDifferences = diff.getAllDifferences();
    Assert.assertEquals(allDifferences.size(), 0);
}
 
开发者ID:jrobotframework,项目名称:jrobotframework-report,代码行数:27,代码来源:StatTest.java

示例10: 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

示例11: testDump

import org.custommonkey.xmlunit.DetailedDiff; //导入依赖的package包/类
@org.testng.annotations.Test(dependsOnMethods = {"testLoad"})
public void testDump() throws IOException, SAXException {
    String xml = xstream.toXML(suite);
    InputStream in = null;
    String content = null;
    try {
        in = getClass().getResourceAsStream("/Suite.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,代码来源:SuiteTest.java

示例12: testDump

import org.custommonkey.xmlunit.DetailedDiff; //导入依赖的package包/类
@Test
public void testDump() throws IOException, SAXException {
    Arguments arguments = new Arguments();
    arguments.setArgs(args);
    String xml = xstream.toXML(arguments);
    InputStream in = null;
    String content = null;
    try {
        in = getClass().getResourceAsStream("/Arguments.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,代码来源:ArgumentsTest.java

示例13: testDump

import org.custommonkey.xmlunit.DetailedDiff; //导入依赖的package包/类
@Test
public void testDump() throws IOException, SAXException {
    Status status = new Status();
    status.setStarttime(starttime);
    status.setEndtime(endtime);
    status.setStatus(state);
    String xml = xstream.toXML(status);
    InputStream in = null;
    String content = null;
    try {
        in = getClass().getResourceAsStream("/Status.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,代码来源:StatusTest.java

示例14: 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

示例15: 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


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