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


Java XMLTestCase类代码示例

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


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

示例1: testAppendXML

import org.custommonkey.xmlunit.XMLTestCase; //导入依赖的package包/类
/**
 * Does adapter.readXML(input), then compares the input with adapter.writeXML
 */
public static void testAppendXML(XMLStructureAdapter adapter, String input, String nsPrefix, String nameSpace) throws SAXException, IOException
{
    adapter.readXML(input);        
    StringBuilder buf = new StringBuilder();
    adapter.appendXML(buf, new XMLFormatting(), nsPrefix,nameSpace);        
    XMLTestCase xmlTester = new XMLTestCase(""){};
    XMLUnit.setIgnoreWhitespace(true);
    xmlTester.assertXMLEqual(input, buf.toString()); 
}
 
开发者ID:ArticulatedSocialAgentsPlatform,项目名称:HmiCore,代码行数:13,代码来源:XMLTestUtils.java

示例2: initialize

import org.custommonkey.xmlunit.XMLTestCase; //导入依赖的package包/类
@Before
public void initialize() {
	this.xstream = new XStreamInstance();
	this.xmlUnit = new XMLTestCase() {
	};
}
 
开发者ID:orionhealth,项目名称:rlc-analyser,代码行数:7,代码来源:EngineTest.java

示例3: setUpXStream

import org.custommonkey.xmlunit.XMLTestCase; //导入依赖的package包/类
@Before
public void setUpXStream() {
	this.xstream = new XStreamInstance();
	this.xmlUnit = new XMLTestCase() {
	};
}
 
开发者ID:orionhealth,项目名称:rlc-analyser,代码行数:7,代码来源:CommunicationPointTest.java

示例4: initialize

import org.custommonkey.xmlunit.XMLTestCase; //导入依赖的package包/类
/**
 * Initializing method.
 */
@PostConstruct
public void initialize() {
	xmlTest = new XMLTestCase() {
	};
}
 
开发者ID:kuzavas,项目名称:ephesoft,代码行数:9,代码来源:DcmaTestCase.java

示例5: testNormalizedNodeToXmlSerialization

import org.custommonkey.xmlunit.XMLTestCase; //导入依赖的package包/类
@Test
public void testNormalizedNodeToXmlSerialization() throws XMLStreamException, IOException, SAXException {
    final SchemaContext schemaContext = YangParserTestUtils.parseYangResource("/baz.yang");

    final Document doc = loadDocument("/baz.xml");

    final DOMResult domResult = new DOMResult(UntrustedXML.newDocumentBuilder().newDocument());

    final XMLOutputFactory factory = XMLOutputFactory.newInstance();
    factory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);

    final XMLStreamWriter xmlStreamWriter = factory.createXMLStreamWriter(domResult);

    final NormalizedNodeStreamWriter xmlNormalizedNodeStreamWriter = XMLStreamNormalizedNodeStreamWriter.create(
            xmlStreamWriter, schemaContext);

    final NormalizedNodeWriter normalizedNodeWriter = NormalizedNodeWriter.forStreamWriter(
            xmlNormalizedNodeStreamWriter);

    normalizedNodeWriter.write(buildOuterContainerNode());

    XMLUnit.setIgnoreWhitespace(true);
    XMLUnit.setNormalize(true);

    final String expectedXml = toString(doc.getDocumentElement());
    final String serializedXml = toString(domResult.getNode());
    final Diff diff = new Diff(expectedXml, serializedXml);

    final DifferenceListener differenceListener = new IgnoreTextAndAttributeValuesDifferenceListener();
    diff.overrideDifferenceListener(differenceListener);

    new XMLTestCase() {}.assertXMLEqual(diff, true);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:34,代码来源:NormalizedNodesToXmlTest.java


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