< prev index next >

test/javax/xml/jaxp/unittest/stream/XMLStreamExceptionTest/ExceptionTest.java

Print this page




  36  * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
  37  * @run testng/othervm -DrunSecMngr=true stream.XMLStreamExceptionTest.ExceptionTest
  38  * @run testng/othervm stream.XMLStreamExceptionTest.ExceptionTest
  39  * @summary Test XMLStreamException contains the message of the wrapped exception.
  40  */
  41 @Listeners({jaxp.library.BasePolicy.class})
  42 public class ExceptionTest {
  43 
  44     @Test
  45     public void testException() {
  46 
  47         final String EXPECTED_OUTPUT = "Test XMLStreamException";
  48         try {
  49             Exception ex = new IOException("Test XMLStreamException");
  50             throw new XMLStreamException(ex);
  51         } catch (XMLStreamException e) {
  52             Assert.assertTrue(e.getMessage().contains(EXPECTED_OUTPUT), "XMLStreamException does not contain the message " + "of the wrapped exception");
  53         }
  54     }
  55 }
  56 


  36  * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
  37  * @run testng/othervm -DrunSecMngr=true stream.XMLStreamExceptionTest.ExceptionTest
  38  * @run testng/othervm stream.XMLStreamExceptionTest.ExceptionTest
  39  * @summary Test XMLStreamException contains the message of the wrapped exception.
  40  */
  41 @Listeners({jaxp.library.BasePolicy.class})
  42 public class ExceptionTest {
  43 
  44     @Test
  45     public void testException() {
  46 
  47         final String EXPECTED_OUTPUT = "Test XMLStreamException";
  48         try {
  49             Exception ex = new IOException("Test XMLStreamException");
  50             throw new XMLStreamException(ex);
  51         } catch (XMLStreamException e) {
  52             Assert.assertTrue(e.getMessage().contains(EXPECTED_OUTPUT), "XMLStreamException does not contain the message " + "of the wrapped exception");
  53         }
  54     }
  55 }

< prev index next >