< prev index next >

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

Print this page


   1 /*
   2  * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 package javax.xml.parsers.ptests;
  25 
  26 import static org.testng.Assert.assertFalse;

  27 import static org.testng.Assert.assertNull;
  28 import static org.testng.Assert.assertTrue;

  29 import javax.xml.parsers.SAXParser;
  30 import javax.xml.parsers.SAXParserFactory;
  31 import jaxp.library.JAXPBaseTest;
  32 import static org.testng.Assert.assertNotNull;
  33 import org.testng.annotations.DataProvider;

  34 import org.testng.annotations.Test;
  35 import org.xml.sax.SAXException;
  36 import org.xml.sax.SAXNotSupportedException;
  37 import org.xml.sax.ext.DeclHandler;
  38 import org.xml.sax.ext.LexicalHandler;
  39 
  40 /**
  41  * Class contains the test cases for SAXParser API
  42  */
  43 public class SAXParserTest02 extends JAXPBaseTest {

  44     private static final String DOM_NODE = "http://xml.org/sax/properties/dom-node";
  45     private static final String XML_STRING = "http://xml.org/sax/properties/xml-string";
  46     private static final String DECL_HANDLER = "http://xml.org/sax/properties/declaration-handler";
  47     private static final String LEXICAL_HANDLER = "http://xml.org/sax/properties/lexical-handler";
  48 
  49     /**
  50      * Provide SAXParser.
  51      *
  52      * @return a data provider contains a SAXParser instance.
  53      * @throws Exception If any errors occur.
  54      */
  55     @DataProvider(name = "parser-provider")
  56     public Object[][] getParser() throws Exception {
  57         SAXParserFactory spf = SAXParserFactory.newInstance();
  58         SAXParser saxparser = spf.newSAXParser();
  59         return new Object[][] { { saxparser } };
  60     }
  61 
  62     /**
  63      * Test to test the default functionality (No validation) of the parser.


   1 /*
   2  * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 package javax.xml.parsers.ptests;
  25 
  26 import static org.testng.Assert.assertFalse;
  27 import static org.testng.Assert.assertNotNull;
  28 import static org.testng.Assert.assertNull;
  29 import static org.testng.Assert.assertTrue;
  30 
  31 import javax.xml.parsers.SAXParser;
  32 import javax.xml.parsers.SAXParserFactory;
  33 

  34 import org.testng.annotations.DataProvider;
  35 import org.testng.annotations.Listeners;
  36 import org.testng.annotations.Test;
  37 import org.xml.sax.SAXException;
  38 import org.xml.sax.SAXNotSupportedException;
  39 import org.xml.sax.ext.DeclHandler;
  40 import org.xml.sax.ext.LexicalHandler;
  41 
  42 /**
  43  * Class contains the test cases for SAXParser API
  44  */
  45 @Listeners({jaxp.library.BasePolicy.class})
  46 public class SAXParserTest02 {
  47     private static final String DOM_NODE = "http://xml.org/sax/properties/dom-node";
  48     private static final String XML_STRING = "http://xml.org/sax/properties/xml-string";
  49     private static final String DECL_HANDLER = "http://xml.org/sax/properties/declaration-handler";
  50     private static final String LEXICAL_HANDLER = "http://xml.org/sax/properties/lexical-handler";
  51 
  52     /**
  53      * Provide SAXParser.
  54      *
  55      * @return a data provider contains a SAXParser instance.
  56      * @throws Exception If any errors occur.
  57      */
  58     @DataProvider(name = "parser-provider")
  59     public Object[][] getParser() throws Exception {
  60         SAXParserFactory spf = SAXParserFactory.newInstance();
  61         SAXParser saxparser = spf.newSAXParser();
  62         return new Object[][] { { saxparser } };
  63     }
  64 
  65     /**
  66      * Test to test the default functionality (No validation) of the parser.


< prev index next >