AbstractCheckExpectedOutputTester.java 文件源码

java
阅读 24 收藏 0 点赞 0 评论 0

项目:ibench 作者:
public void compareFile(String fileLeft, String fileRight) throws SAXException, IOException, ParserConfigurationException, TransformerException {
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    dbf.setNamespaceAware(true);
    dbf.setCoalescing(true);
    dbf.setIgnoringElementContentWhitespace(true);
    dbf.setIgnoringComments(true);

    DocumentBuilder db = dbf.newDocumentBuilder();

    Document doc1 = db.parse(new File(expectedPath + "/" + fileRight + ".xml"));
    doc1.normalizeDocument();

    Document doc2 = db.parse(new File(OUT_DIR + "/" + fileLeft + ".xml"));
    doc2.normalizeDocument();

    assertEquals("Output <" + fileLeft + "> is not the same as expected output <" +
            fileRight + ">", 
            docToString(doc1), 
            docToString(doc2));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号