< prev index next >

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

Print this page




  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 java.io.File;
  27 
  28 import javax.xml.stream.XMLEventReader;
  29 import javax.xml.stream.XMLInputFactory;
  30 import javax.xml.stream.XMLOutputFactory;
  31 
  32 import org.testng.Assert;

  33 import org.testng.annotations.Test;
  34 
  35 /*
  36  * @bug 6668115
  37  * @summary Test XMLEventReader.getElementText() shall update last event even if no peek.
  38  */

  39 public class Bug6668115Test {
  40 
  41     public java.io.File input;
  42     public final String filesDir = "./";
  43     protected XMLInputFactory inputFactory;
  44     protected XMLOutputFactory outputFactory;
  45 
  46     /**
  47      * The reason the following call sequence is a problem is that with a
  48      * peekevent, getElementText calls nextEvent which does properly update the
  49      * lastEvent
  50      */
  51     @Test
  52     public void testNextTag() {
  53         try {
  54             XMLEventReader er = getReader();
  55             er.nextTag();
  56             er.nextTag();
  57 
  58             System.out.println(er.getElementText());




  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 java.io.File;
  27 
  28 import javax.xml.stream.XMLEventReader;
  29 import javax.xml.stream.XMLInputFactory;
  30 import javax.xml.stream.XMLOutputFactory;
  31 
  32 import org.testng.Assert;
  33 import org.testng.annotations.Listeners;
  34 import org.testng.annotations.Test;
  35 
  36 /*
  37  * @bug 6668115
  38  * @summary Test XMLEventReader.getElementText() shall update last event even if no peek.
  39  */
  40 @Listeners({jaxp.library.FilePolicy.class})
  41 public class Bug6668115Test {
  42 
  43     public java.io.File input;
  44     public final String filesDir = "./";
  45     protected XMLInputFactory inputFactory;
  46     protected XMLOutputFactory outputFactory;
  47 
  48     /**
  49      * The reason the following call sequence is a problem is that with a
  50      * peekevent, getElementText calls nextEvent which does properly update the
  51      * lastEvent
  52      */
  53     @Test
  54     public void testNextTag() {
  55         try {
  56             XMLEventReader er = getReader();
  57             er.nextTag();
  58             er.nextTag();
  59 
  60             System.out.println(er.getElementText());


< prev index next >