< prev index next >

test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker70.java

Print this page




  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.XMLStreamReaderTest;
  25 
  26 import java.io.File;
  27 import java.io.FileInputStream;
  28 import java.util.function.Consumer;
  29 
  30 import javax.xml.stream.XMLInputFactory;
  31 import javax.xml.stream.XMLStreamReader;
  32 
  33 import org.testng.Assert;

  34 import org.testng.annotations.Test;
  35 
  36 /*
  37  * @summary Test it can retrieve attribute with null or empty name space.
  38  */

  39 public class IssueTracker70 {
  40 
  41     static private final File testFile = new File(IssueTracker70.class.getResource("IssueTracker70.xml").getFile());
  42 
  43     @Test
  44     public void testGetAttributeValueWithNullNs() throws Exception {
  45         testGetAttributeValueWithNs(null, "attribute2", this::checkNull);
  46     }
  47 
  48     @Test
  49     public void testGetAttributeValueWithEmptyNs() throws Exception {
  50         testGetAttributeValueWithNs("", "attribute1", this::checkNull);
  51     }
  52 
  53 
  54     private void testGetAttributeValueWithNs(String nameSpace, String attrName, Consumer<String> checker) throws Exception {
  55         XMLInputFactory xif = XMLInputFactory.newInstance();
  56         XMLStreamReader xsr = xif.createXMLStreamReader(new FileInputStream(testFile));
  57 
  58         while (xsr.hasNext()) {


  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.XMLStreamReaderTest;
  25 
  26 import java.io.File;
  27 import java.io.FileInputStream;
  28 import java.util.function.Consumer;
  29 
  30 import javax.xml.stream.XMLInputFactory;
  31 import javax.xml.stream.XMLStreamReader;
  32 
  33 import org.testng.Assert;
  34 import org.testng.annotations.Listeners;
  35 import org.testng.annotations.Test;
  36 
  37 /*
  38  * @summary Test it can retrieve attribute with null or empty name space.
  39  */
  40 @Listeners({jaxp.library.FilePolicy.class})
  41 public class IssueTracker70 {
  42 
  43     static private final File testFile = new File(IssueTracker70.class.getResource("IssueTracker70.xml").getFile());
  44 
  45     @Test
  46     public void testGetAttributeValueWithNullNs() throws Exception {
  47         testGetAttributeValueWithNs(null, "attribute2", this::checkNull);
  48     }
  49 
  50     @Test
  51     public void testGetAttributeValueWithEmptyNs() throws Exception {
  52         testGetAttributeValueWithNs("", "attribute1", this::checkNull);
  53     }
  54 
  55 
  56     private void testGetAttributeValueWithNs(String nameSpace, String attrName, Consumer<String> checker) throws Exception {
  57         XMLInputFactory xif = XMLInputFactory.newInstance();
  58         XMLStreamReader xsr = xif.createXMLStreamReader(new FileInputStream(testFile));
  59 
  60         while (xsr.hasNext()) {
< prev index next >