DocumentProcessorTest.java 文件源码

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

项目:java-aci-api-ng 作者:
@Test(expected = FactoryConfigurationError.class)
public void testConvertACIResponseToDOMInvalidDocumentBuilderFactory() throws AciErrorException, IOException, ProcessorException {
    // Set a duff property for the DocumentBuilderFactory...
    System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "com.autonomy.DuffDocumentBuilderFactory");

    try {
        // Setup with a proper XML response file...
        final BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
        response.setEntity(new InputStreamEntity(getClass().getResourceAsStream("/GetVersion.xml"), -1));

        // Set the AciResponseInputStream...
        final AciResponseInputStream stream = new AciResponseInputStreamImpl(response);

        // Process...
        processor.process(stream);
        fail("Should have raised an ProcessorException.");
    } finally {
        // Remove the duff system property...
        System.clearProperty("javax.xml.parsers.DocumentBuilderFactory");
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号