jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/othervm/TFCErrorTest.java
changeset 40223 64662417aa2d
parent 28445 5a87f52ca380
child 40829 ad509d5baa06
equal deleted inserted replaced
40222:ec0a4bdb7a07 40223:64662417aa2d
     1 /*
     1 /*
     2  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    20  * or visit www.oracle.com if you need additional information or have any
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 package javax.xml.transform.ptests.othervm;
    23 package javax.xml.transform.ptests.othervm;
    24 
    24 
    25 import javax.xml.transform.*;
    25 import static jaxp.library.JAXPTestUtilities.setSystemProperty;
    26 import jaxp.library.JAXPBaseTest;
    26 
    27 import static org.testng.Assert.fail;
    27 import static org.testng.Assert.fail;
       
    28 
       
    29 import javax.xml.transform.TransformerFactory;
       
    30 import javax.xml.transform.TransformerFactoryConfigurationError;
       
    31 
       
    32 import org.testng.annotations.Listeners;
    28 import org.testng.annotations.Test;
    33 import org.testng.annotations.Test;
    29 
    34 
    30 /**
    35 /**
    31  * Negative test for set invalid TransformerFactory property.
    36  * Negative test for set invalid TransformerFactory property.
    32  */
    37  */
    33 public class TFCErrorTest  extends JAXPBaseTest {
    38 /*
       
    39  * @test
       
    40  * @library /javax/xml/jaxp/libs
       
    41  * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.othervm.TFCErrorTest
       
    42  * @run testng/othervm javax.xml.transform.ptests.othervm.TFCErrorTest
       
    43  */
       
    44 @Listeners({jaxp.library.BasePolicy.class})
       
    45 public class TFCErrorTest {
    34     @Test(expectedExceptions = ClassNotFoundException.class)
    46     @Test(expectedExceptions = ClassNotFoundException.class)
    35     public void tfce01() throws Exception {
    47     public void tfce01() throws Exception {
    36         try{
    48         try{
    37             setSystemProperty("javax.xml.transform.TransformerFactory","xx");
    49             setSystemProperty("javax.xml.transform.TransformerFactory","xx");
    38             TransformerFactory.newInstance();
    50             TransformerFactory.newInstance();
    40         } catch (TransformerFactoryConfigurationError expected) {
    52         } catch (TransformerFactoryConfigurationError expected) {
    41             throw expected.getException();
    53             throw expected.getException();
    42         }
    54         }
    43     }
    55     }
    44 }
    56 }
       
    57 
       
    58