< prev index next >

test/javax/xml/jaxp/unittest/parsers/SupplementaryChars.java

Print this page


   1 package parsers;
   2 
   3 import java.io.ByteArrayInputStream;
   4 import javax.xml.parsers.SAXParser;
   5 import javax.xml.parsers.SAXParserFactory;
   6 
   7 import org.testng.annotations.DataProvider;

   8 import org.testng.annotations.Test;
   9 import org.xml.sax.SAXParseException;
  10 import org.xml.sax.helpers.DefaultHandler;
  11 
  12 /**
  13  * @bug 8072081
  14  * @summary verifies that supplementary characters are supported as character
  15  * data in xml 1.0, and also names in xml 1.1.
  16  *
  17  * Joe Wang (huizhe.wang@oracle.com)
  18  */
  19 

  20 public class SupplementaryChars {
  21 
  22     @Test(dataProvider = "supported")
  23     public void test(String xml) throws Exception {
  24         ByteArrayInputStream stream = new ByteArrayInputStream(xml.getBytes("UTF-8"));
  25         getParser().parse(stream, new DefaultHandler());
  26         stream.close();
  27     }
  28 
  29     @Test(dataProvider = "unsupported", expectedExceptions = SAXParseException.class)
  30     public void testInvalid(String xml) throws Exception {
  31         ByteArrayInputStream stream = new ByteArrayInputStream(xml.getBytes("UTF-8"));
  32         getParser().parse(stream, new DefaultHandler());
  33         stream.close();
  34     }
  35 
  36     @DataProvider(name = "supported")
  37     private Object[][] supported() {
  38 
  39         return new Object[][] {


   1 package parsers;
   2 
   3 import java.io.ByteArrayInputStream;
   4 import javax.xml.parsers.SAXParser;
   5 import javax.xml.parsers.SAXParserFactory;
   6 
   7 import org.testng.annotations.DataProvider;
   8 import org.testng.annotations.Listeners;
   9 import org.testng.annotations.Test;
  10 import org.xml.sax.SAXParseException;
  11 import org.xml.sax.helpers.DefaultHandler;
  12 
  13 /**
  14  * @bug 8072081
  15  * @summary verifies that supplementary characters are supported as character
  16  * data in xml 1.0, and also names in xml 1.1.
  17  *
  18  * Joe Wang (huizhe.wang@oracle.com)
  19  */
  20 
  21 @Listeners({jaxp.library.BasePolicy.class})
  22 public class SupplementaryChars {
  23 
  24     @Test(dataProvider = "supported")
  25     public void test(String xml) throws Exception {
  26         ByteArrayInputStream stream = new ByteArrayInputStream(xml.getBytes("UTF-8"));
  27         getParser().parse(stream, new DefaultHandler());
  28         stream.close();
  29     }
  30 
  31     @Test(dataProvider = "unsupported", expectedExceptions = SAXParseException.class)
  32     public void testInvalid(String xml) throws Exception {
  33         ByteArrayInputStream stream = new ByteArrayInputStream(xml.getBytes("UTF-8"));
  34         getParser().parse(stream, new DefaultHandler());
  35         stream.close();
  36     }
  37 
  38     @DataProvider(name = "supported")
  39     private Object[][] supported() {
  40 
  41         return new Object[][] {


< prev index next >