< prev index next >

test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/FactoryConfErrorTest.java

Print this page

        

*** 24,62 **** package javax.xml.parsers.ptests; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.FactoryConfigurationError; import javax.xml.parsers.SAXParserFactory; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; /** * Class containing the test cases for SAXParserFactory/DocumentBuilderFactory * newInstance methods. */ ! public class FactoryConfErrorTest { /** * Set properties DocumentBuilderFactory and SAXParserFactory to invalid * value before any test run. */ @BeforeTest public void setup() { ! System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "xx"); ! System.setProperty("javax.xml.parsers.SAXParserFactory", "xx"); } /** * Restore properties DocumentBuilderFactory and SAXParserFactory to default * value after all tests run. */ @AfterTest public void cleanup() { ! System.clearProperty("javax.xml.parsers.DocumentBuilderFactory"); ! System.clearProperty("javax.xml.parsers.SAXParserFactory"); } /** * To test exception thrown if javax.xml.parsers.SAXParserFactory property * is invalid. --- 24,63 ---- package javax.xml.parsers.ptests; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.FactoryConfigurationError; import javax.xml.parsers.SAXParserFactory; + import jaxp.library.JAXPBaseTest; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; /** * Class containing the test cases for SAXParserFactory/DocumentBuilderFactory * newInstance methods. */ ! public class FactoryConfErrorTest extends JAXPBaseTest { /** * Set properties DocumentBuilderFactory and SAXParserFactory to invalid * value before any test run. */ @BeforeTest public void setup() { ! setSystemProperty("javax.xml.parsers.DocumentBuilderFactory", "xx"); ! setSystemProperty("javax.xml.parsers.SAXParserFactory", "xx"); } /** * Restore properties DocumentBuilderFactory and SAXParserFactory to default * value after all tests run. */ @AfterTest public void cleanup() { ! setSystemProperty("javax.xml.parsers.DocumentBuilderFactory", null); ! setSystemProperty("javax.xml.parsers.SAXParserFactory", null); } /** * To test exception thrown if javax.xml.parsers.SAXParserFactory property * is invalid.
*** 65,75 **** public void testNewInstance01() { SAXParserFactory.newInstance(); } /** ! * To test exeception thrown if javax.xml.parsers.DocumentBuilderFactory is * invalid. */ @Test(expectedExceptions = FactoryConfigurationError.class) public void testNewInstance02() { DocumentBuilderFactory.newInstance(); --- 66,76 ---- public void testNewInstance01() { SAXParserFactory.newInstance(); } /** ! * To test exception thrown if javax.xml.parsers.DocumentBuilderFactory is * invalid. */ @Test(expectedExceptions = FactoryConfigurationError.class) public void testNewInstance02() { DocumentBuilderFactory.newInstance();
< prev index next >