use of com.progress.xref.InvalidXMLFilterStream in project sonar-openedge by Riverside-Software.
the class InvalidXMLFilterStreamTest method testValidFile.
@Test
public void testValidFile() throws IOException {
InputStream input = new FileInputStream(new File("src/test/resources/file1.xml"));
InvalidXMLFilterStream input2 = new InvalidXMLFilterStream(input);
try {
DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(input2);
} catch (ParserConfigurationException | SAXException uncaught) {
throw new RuntimeException(uncaught);
}
}
use of com.progress.xref.InvalidXMLFilterStream in project sonar-openedge by Riverside-Software.
the class InvalidXMLFilterStreamTest method testInvalidFile.
@Test
public void testInvalidFile() throws IOException {
InputStream input = new FileInputStream(new File("src/test/resources/file2.xml"));
InvalidXMLFilterStream input2 = new InvalidXMLFilterStream(input);
try {
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(input2);
assertNotNull(doc.getFirstChild());
assertTrue(doc.getFirstChild().getChildNodes().getLength() > 2);
Node node = doc.getFirstChild().getChildNodes().item(1);
assertEquals(node.getAttributes().getNamedItem("File-name").getNodeValue(), "src\\procedures\\ sample\\test7.p");
} catch (ParserConfigurationException | SAXException uncaught) {
throw new RuntimeException(uncaught);
}
}
Aggregations