< prev index next >

test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderTest.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 20,52 **** * or visit www.oracle.com if you need additional information or have any * questions. */ package org.xml.sax.ptests; - import java.io.FileInputStream; - import javax.xml.parsers.SAXParserFactory; - import jaxp.library.JAXPFileReadOnlyBaseTest; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNull; import static org.testng.Assert.assertTrue; import org.testng.annotations.Test; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; import org.xml.sax.XMLReader; import org.xml.sax.ext.DeclHandler; import org.xml.sax.ext.LexicalHandler; import org.xml.sax.helpers.XMLFilterImpl; - import static org.xml.sax.ptests.SAXTestConst.XML_DIR; /** * Class containing the test cases for SAXParser API */ ! public class XMLReaderTest extends JAXPFileReadOnlyBaseTest { /** * XML namespaces. */ private static final String NAMESPACES --- 20,56 ---- * or visit www.oracle.com if you need additional information or have any * questions. */ package org.xml.sax.ptests; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNull; import static org.testng.Assert.assertTrue; + import static org.xml.sax.ptests.SAXTestConst.XML_DIR; + + import java.io.FileInputStream; + + import javax.xml.parsers.SAXParserFactory; + + import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; import org.xml.sax.XMLReader; import org.xml.sax.ext.DeclHandler; import org.xml.sax.ext.LexicalHandler; import org.xml.sax.helpers.XMLFilterImpl; /** * Class containing the test cases for SAXParser API */ ! @Listeners({jaxp.library.FilePolicy.class}) ! public class XMLReaderTest { /** * XML namespaces. */ private static final String NAMESPACES
*** 432,442 **** /** * Unit test for parse a error-formatted file. SAXException is expected. * * @throws Exception If any errors occur. */ ! @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class) public void parse02() throws Exception { try (FileInputStream fis = new FileInputStream(XML_DIR + "invalid.xml")) { SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setNamespaceAware(true); spf.newSAXParser().getXMLReader().parse(new InputSource(fis)); --- 436,446 ---- /** * Unit test for parse a error-formatted file. SAXException is expected. * * @throws Exception If any errors occur. */ ! @Test(expectedExceptions = SAXException.class) public void parse02() throws Exception { try (FileInputStream fis = new FileInputStream(XML_DIR + "invalid.xml")) { SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setNamespaceAware(true); spf.newSAXParser().getXMLReader().parse(new InputSource(fis));
*** 446,456 **** /** * Unit test for parse a well-formatted file. No exception is expected. * * @throws Exception If any errors occur. */ ! @Test(groups = {"readLocalFiles"}) public void parse03() throws Exception { try (FileInputStream fis = new FileInputStream(XML_DIR + "correct2.xml")) { SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setNamespaceAware(true); spf.newSAXParser().getXMLReader().parse(new InputSource(fis)); --- 450,460 ---- /** * Unit test for parse a well-formatted file. No exception is expected. * * @throws Exception If any errors occur. */ ! @Test public void parse03() throws Exception { try (FileInputStream fis = new FileInputStream(XML_DIR + "correct2.xml")) { SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setNamespaceAware(true); spf.newSAXParser().getXMLReader().parse(new InputSource(fis));
< prev index next >