< prev index next >

test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFactoryTest.java

Print this page

        

@@ -24,18 +24,18 @@
 package javax.xml.xpath.ptests;
 
 import static javax.xml.xpath.XPathConstants.DOM_OBJECT_MODEL;
 import javax.xml.xpath.XPathFactory;
 import javax.xml.xpath.XPathFactoryConfigurationException;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import jaxp.library.JAXPBaseTest;
 import static org.testng.AssertJUnit.assertNotNull;
 import org.testng.annotations.Test;
 
 /**
  * Class containing the test cases for XPathFactory API.
  */
-public class XPathFactoryTest {
+public class XPathFactoryTest extends JAXPBaseTest {
     /**
      * Valid URL for creating a XPath factory.
      */
     private static final String VALID_URL = "http://java.sun.com/jaxp/xpath/dom";
 

@@ -52,49 +52,49 @@
         assertNotNull(XPathFactory.newInstance());
     }
 
     /**
      * XPathFactory.newInstance(String uri) throws NPE if uri is null.
+     * 
+     * XPathFactoryConfigurationException If the specified object model
+    *          is unavailable, or if there is a configuration error.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    private void testCheckXPathFactory02() {
-        try {
+    public void testCheckXPathFactory02() throws XPathFactoryConfigurationException {
             XPathFactory.newInstance(null);
-        } catch (XPathFactoryConfigurationException ex) {
-            failUnexpected(ex);
-        }
     }
 
     /**
      * XPathFactory.newInstance(String uri) throws XPFCE if uri is just a blank
      * string.
      *
-     * @throws XPathFactoryConfigurationException
+     * @throws XPathFactoryConfigurationException If the specified object model
+    *          is unavailable, or if there is a configuration error.
      */
     @Test(expectedExceptions = XPathFactoryConfigurationException.class)
     public void testCheckXPathFactory03() throws XPathFactoryConfigurationException {
         XPathFactory.newInstance(" ");
     }
 
     /**
      * Test for constructor - XPathFactory.newInstance(String uri) with valid
      * url - "http://java.sun.com/jaxp/xpath/dom".
+     * 
+     * @throws XPathFactoryConfigurationException If the specified object model
+    *          is unavailable, or if there is a configuration error.
      */
     @Test
-    public void testCheckXPathFactory04() {
-        try {
+    public void testCheckXPathFactory04() throws XPathFactoryConfigurationException {
             assertNotNull(XPathFactory.newInstance(VALID_URL));
-        } catch (XPathFactoryConfigurationException ex) {
-            failUnexpected(ex);
-        }
     }
 
     /**
      * Test for constructor - XPathFactory.newInstance(String uri) with invalid
      * url - "http://java.sun.com/jaxp/xpath/dom1".
      *
-     * @throws XPathFactoryConfigurationException
+     * @throws XPathFactoryConfigurationException If the specified object model
+    *          is unavailable, or if there is a configuration error.
      */
     @Test(expectedExceptions = XPathFactoryConfigurationException.class)
     public void testCheckXPathFactory05() throws XPathFactoryConfigurationException {
         XPathFactory.newInstance(INVALID_URL);
     }

@@ -110,28 +110,26 @@
 
     /**
      * Test for constructor - XPathFactory.newInstance(String uri) with valid
      * url - "http://java.sun.com/jaxp/xpath/dom" and creating XPath with
      * newXPath().
+     *
+     * @throws XPathFactoryConfigurationException If the specified object model
+    *          is unavailable, or if there is a configuration error.
      */
     @Test
-    public void testCheckXPathFactory07() {
-        try {
+    public void testCheckXPathFactory07() throws XPathFactoryConfigurationException {
             assertNotNull(XPathFactory.newInstance(VALID_URL).newXPath());
-        } catch (XPathFactoryConfigurationException ex) {
-            failUnexpected(ex);
-        }
     }
 
     /**
      * Test for constructor - XPathFactory.newInstance(String uri) with valid
      * uri - DOM_OBJECT_MODEL.toString().
+     *
+     * @throws XPathFactoryConfigurationException If the specified object model
+    *          is unavailable, or if there is a configuration error.
      */
     @Test
-    public void testCheckXPathFactory08() {
-        try {
+    public void testCheckXPathFactory08() throws XPathFactoryConfigurationException {
             assertNotNull(XPathFactory.newInstance(DOM_OBJECT_MODEL));
-        } catch (XPathFactoryConfigurationException ex) {
-            failUnexpected(ex);
-        }
     }
 }
< prev index next >