< prev index next >

test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/UnprefixedNameTest.java

Print this page




  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 stream.XMLStreamWriterTest;
  25 
  26 import javax.xml.stream.XMLOutputFactory;
  27 import javax.xml.stream.XMLStreamException;
  28 import javax.xml.stream.XMLStreamWriter;
  29 
  30 import org.testng.Assert;

  31 import org.testng.annotations.Test;
  32 
  33 /*
  34  * @bug 6394074
  35  * @summary Test XMLStreamWriter namespace prefix with writeDefaultNamespace.
  36  */

  37 public class UnprefixedNameTest {
  38 
  39     @Test
  40     public void testUnboundPrefix() throws Exception {
  41 
  42         try {
  43             XMLOutputFactory xof = XMLOutputFactory.newInstance();
  44             XMLStreamWriter w = xof.createXMLStreamWriter(System.out);
  45             // here I'm trying to write
  46             // <bar xmlns="foo" />
  47             w.writeStartDocument();
  48             w.writeStartElement("foo", "bar");
  49             w.writeDefaultNamespace("foo");
  50             w.writeCharacters("---");
  51             w.writeEndElement();
  52             w.writeEndDocument();
  53             w.close();
  54 
  55             // Unexpected success
  56             String FAIL_MSG = "Unexpected success.  Expected: " + "XMLStreamException - " + "if the namespace URI has not been bound to a prefix "




  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 stream.XMLStreamWriterTest;
  25 
  26 import javax.xml.stream.XMLOutputFactory;
  27 import javax.xml.stream.XMLStreamException;
  28 import javax.xml.stream.XMLStreamWriter;
  29 
  30 import org.testng.Assert;
  31 import org.testng.annotations.Listeners;
  32 import org.testng.annotations.Test;
  33 
  34 /*
  35  * @bug 6394074
  36  * @summary Test XMLStreamWriter namespace prefix with writeDefaultNamespace.
  37  */
  38 @Listeners({jaxp.library.BasePolicy.class})
  39 public class UnprefixedNameTest {
  40 
  41     @Test
  42     public void testUnboundPrefix() throws Exception {
  43 
  44         try {
  45             XMLOutputFactory xof = XMLOutputFactory.newInstance();
  46             XMLStreamWriter w = xof.createXMLStreamWriter(System.out);
  47             // here I'm trying to write
  48             // <bar xmlns="foo" />
  49             w.writeStartDocument();
  50             w.writeStartElement("foo", "bar");
  51             w.writeDefaultNamespace("foo");
  52             w.writeCharacters("---");
  53             w.writeEndElement();
  54             w.writeEndDocument();
  55             w.close();
  56 
  57             // Unexpected success
  58             String FAIL_MSG = "Unexpected success.  Expected: " + "XMLStreamException - " + "if the namespace URI has not been bound to a prefix "


< prev index next >