< prev index next >

test/javax/xml/jaxp/functional/javax/xml/transform/ptests/ErrorListenerTest.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.
*** 21,47 **** * questions. */ package javax.xml.transform.ptests; import java.io.File; ! import java.io.FilePermission; import javax.xml.transform.ErrorListener; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; - import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; import javax.xml.transform.stream.StreamSource; ! import jaxp.library.JAXPBaseTest; ! import static org.testng.Assert.assertEquals; ! import static org.testng.Assert.fail; import org.testng.annotations.Test; /** * Class containing the test cases for ErrorListener interface */ ! public class ErrorListenerTest extends JAXPBaseTest implements ErrorListener { /** * Define ErrorListener's status. */ private static enum ListenerStatus{NOT_INVOKED, ERROR, WARNING, FATAL}; --- 21,50 ---- * questions. */ package javax.xml.transform.ptests; + import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; + import static org.testng.Assert.assertEquals; + import static org.testng.Assert.fail; + import java.io.File; ! import javax.xml.transform.ErrorListener; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamSource; ! ! import org.testng.annotations.Listeners; import org.testng.annotations.Test; /** * Class containing the test cases for ErrorListener interface */ ! @Listeners({jaxp.library.FilePolicy.class}) ! public class ErrorListenerTest implements ErrorListener { /** * Define ErrorListener's status. */ private static enum ListenerStatus{NOT_INVOKED, ERROR, WARNING, FATAL};
*** 58,68 **** public void errorListener01() { ErrorListenerTest listener = new ErrorListenerTest(); try { TransformerFactory tfactory = TransformerFactory.newInstance(); tfactory.setErrorListener (listener); - setPermissions(new FilePermission(XML_DIR + "invalid.xsl", "read")); tfactory.newTransformer(new StreamSource( new File(XML_DIR + "invalid.xsl"))); fail("Expect TransformerConfigurationException here"); } catch (TransformerConfigurationException ex) { assertEquals(listener.status, ListenerStatus.FATAL); --- 61,70 ----
< prev index next >