< prev index next >

test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6489890.java

Print this page




  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 stream.XMLEventReaderTest;
  25 
  26 import javax.xml.stream.XMLEventReader;
  27 import javax.xml.stream.XMLInputFactory;
  28 import javax.xml.stream.XMLStreamReader;
  29 import javax.xml.stream.events.XMLEvent;
  30 
  31 import org.testng.Assert;

  32 import org.testng.annotations.Test;
  33 
  34 /*
  35  * @bug 6489890
  36  * @summary Test XMLEventReader's initial state is an undefined state, and nextEvent() is START_DOCUMENT.
  37  */

  38 public class Bug6489890 {
  39 
  40     @Test
  41     public void test0() {
  42         try {
  43             XMLInputFactory xif = XMLInputFactory.newInstance();
  44 
  45             XMLStreamReader xsr = xif.createXMLStreamReader(getClass().getResource("sgml.xml").toString(), getClass().getResourceAsStream("sgml.xml"));
  46 
  47             XMLEventReader xer = xif.createXMLEventReader(xsr);
  48 
  49             Assert.assertTrue(xer.peek().getEventType() == XMLEvent.START_DOCUMENT);
  50             Assert.assertTrue(xer.peek() == xer.nextEvent());
  51             xsr.close();
  52         } catch (Exception e) {
  53             Assert.fail(e.getMessage());
  54         }
  55     }
  56 
  57     @Test


  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 stream.XMLEventReaderTest;
  25 
  26 import javax.xml.stream.XMLEventReader;
  27 import javax.xml.stream.XMLInputFactory;
  28 import javax.xml.stream.XMLStreamReader;
  29 import javax.xml.stream.events.XMLEvent;
  30 
  31 import org.testng.Assert;
  32 import org.testng.annotations.Listeners;
  33 import org.testng.annotations.Test;
  34 
  35 /*
  36  * @bug 6489890
  37  * @summary Test XMLEventReader's initial state is an undefined state, and nextEvent() is START_DOCUMENT.
  38  */
  39 @Listeners({jaxp.library.FilePolicy.class})
  40 public class Bug6489890 {
  41 
  42     @Test
  43     public void test0() {
  44         try {
  45             XMLInputFactory xif = XMLInputFactory.newInstance();
  46 
  47             XMLStreamReader xsr = xif.createXMLStreamReader(getClass().getResource("sgml.xml").toString(), getClass().getResourceAsStream("sgml.xml"));
  48 
  49             XMLEventReader xer = xif.createXMLEventReader(xsr);
  50 
  51             Assert.assertTrue(xer.peek().getEventType() == XMLEvent.START_DOCUMENT);
  52             Assert.assertTrue(xer.peek() == xer.nextEvent());
  53             xsr.close();
  54         } catch (Exception e) {
  55             Assert.fail(e.getMessage());
  56         }
  57     }
  58 
  59     @Test
< prev index next >