harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r415555 [4/17] - in /incubator/harmony/enhanced/classlib/trunk/modules/security: make/common/ src/test/api/java.injected/java/security/acl/ src/test/api/java.injected/java/security/cert/ src/test/api/java.injected/java/security/interfaces/ ...
Date Tue, 20 Jun 2006 08:11:19 GMT
Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertPathBuilderExceptionTest.java (from r414728, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/cert/CertPathBuilderExceptionTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertPathBuilderExceptionTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertPathBuilderExceptionTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/cert/CertPathBuilderExceptionTest.java&r1=414728&r2=415555&rev=415555&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/cert/CertPathBuilderExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertPathBuilderExceptionTest.java Tue Jun 20 01:11:04 2006
@@ -1,241 +1,241 @@
-/*
- *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-/**
-* @author Vera Y. Petrashkova
-* @version $Revision$
-*/
-
-package java.security.cert;
-
-import java.security.cert.CertPathBuilderException;
-
-import junit.framework.TestCase;
-
-
-/**
- * Tests for <code>CertPathBuilderException</code> class constructors and
- * methods.
- * 
- */
-public class CertPathBuilderExceptionTest extends TestCase {
-
-    public static void main(String[] args) {
-    }
-
-    /**
-     * Constructor for CertPathBuilderExceptionTests.
-     * 
-     * @param arg0
-     */
-    public CertPathBuilderExceptionTest(String arg0) {
-        super(arg0);
-    }
-
-    private static String[] msgs = {
-            "",
-            "Check new message",
-            "Check new message Check new message Check new message Check new message Check new message" };
-
-    private static Throwable tCause = new Throwable("Throwable for exception");
-
-    static String createErr(Exception tE, Exception eE) {
-        return "CertPathBuilderException ".concat(tE.toString()).concat(
-                " is not equal to caught exception: ").concat(eE.toString());
-    }
-
-    /**
-     * Test for <code>CertPathBuilderException()</code> constructor Assertion:
-     * constructs CertPathBuilderException with no detail message
-     */
-    public void testCertPathBuilderException01() {
-        CertPathBuilderException tE = new CertPathBuilderException();
-        assertNull("getMessage() must return null.", tE.getMessage());
-        assertNull("getCause() must return null", tE.getCause());
-        try {
-            throw tE;
-        } catch (Exception e) {
-            assertTrue(createErr(tE, e), tE.equals(e));
-        }
-    }
-
-    /**
-     * Test for <code>CertPathBuilderException(String)</code> constructor
-     * Assertion: constructs CertPathBuilderException with detail message msg.
-     * Parameter <code>msg</code> is not null.
-     */
-    public void testCertPathBuilderException02() {
-        CertPathBuilderException tE;
-        for (int i = 0; i < msgs.length; i++) {
-            tE = new CertPathBuilderException(msgs[i]);
-            assertEquals("getMessage() must return: ".concat(msgs[i]), tE
-                    .getMessage(), msgs[i]);
-            assertNull("getCause() must return null", tE.getCause());
-            try {
-                throw tE;
-            } catch (Exception e) {
-                assertTrue(createErr(tE, e), tE.equals(e));
-            }
-        }
-    }
-
-    /**
-     * Test for <code>CertPathBuilderException(String)</code> constructor
-     * Assertion: constructs CertPathBuilderException when <code>msg</code> is
-     * null
-     */
-    public void testCertPathBuilderException03() {
-        String msg = null;
-        CertPathBuilderException tE = new CertPathBuilderException(msg);
-        assertNull("getMessage() must return null.", tE.getMessage());
-        assertNull("getCause() must return null", tE.getCause());
-        try {
-            throw tE;
-        } catch (Exception e) {
-            assertTrue(createErr(tE, e), tE.equals(e));
-        }
-    }
-
-    /**
-     * Test for <code>CertPathBuilderException(Throwable)</code> constructor
-     * Assertion: constructs CertPathBuilderException when <code>cause</code>
-     * is null
-     */
-    public void testCertPathBuilderException04() {
-        Throwable cause = null;
-        CertPathBuilderException tE = new CertPathBuilderException(cause);
-        assertNull("getMessage() must return null.", tE.getMessage());
-        assertNull("getCause() must return null", tE.getCause());
-        try {
-            throw tE;
-        } catch (Exception e) {
-            assertTrue(createErr(tE, e), tE.equals(e));
-        }
-    }
-
-    /**
-     * Test for <code>CertPathBuilderException(Throwable)</code> constructor
-     * Assertion: constructs CertPathBuilderException when <code>cause</code>
-     * is not null
-     */
-    public void testCertPathBuilderException05() {
-        CertPathBuilderException tE = new CertPathBuilderException(tCause);
-        if (tE.getMessage() != null) {
-            String toS = tCause.toString();
-            String getM = tE.getMessage();
-            assertTrue("getMessage() should contain ".concat(toS), (getM
-                    .indexOf(toS) != -1));
-        }
-        assertNotNull("getCause() must not return null", tE.getCause());
-        assertEquals("getCause() must return ".concat(tCause.toString()), tE
-                .getCause(), tCause);
-        try {
-            throw tE;
-        } catch (Exception e) {
-            assertTrue(createErr(tE, e), tE.equals(e));
-        }
-    }
-
-    /**
-     * Test for <code>CertPathBuilderException(String, Throwable)</code>
-     * constructor Assertion: constructs CertPathBuilderException when
-     * <code>cause</code> is null <code>msg</code> is null
-     */
-    public void testCertPathBuilderException06() {
-        CertPathBuilderException tE = new CertPathBuilderException(null, null);
-        assertNull("getMessage() must return null", tE.getMessage());
-        assertNull("getCause() must return null", tE.getCause());
-        try {
-            throw tE;
-        } catch (Exception e) {
-            assertTrue(createErr(tE, e), tE.equals(e));
-        }
-    }
-
-    /**
-     * Test for <code>CertPathBuilderException(String, Throwable)</code>
-     * constructor Assertion: constructs CertPathBuilderException when
-     * <code>cause</code> is null <code>msg</code> is not null
-     */
-    public void testCertPathBuilderException07() {
-        CertPathBuilderException tE;
-        for (int i = 0; i < msgs.length; i++) {
-            tE = new CertPathBuilderException(msgs[i], null);
-            assertEquals("getMessage() must return: ".concat(msgs[i]), tE
-                    .getMessage(), msgs[i]);
-            assertNull("getCause() must return null", tE.getCause());
-            try {
-                throw tE;
-            } catch (Exception e) {
-                assertTrue(createErr(tE, e), tE.equals(e));
-            }
-        }
-    }
-
-    /**
-     * Test for <code>CertPathBuilderException(String, Throwable)</code>
-     * constructor Assertion: constructs CertPathBuilderException when
-     * <code>cause</code> is not null <code>msg</code> is null
-     */
-    public void testCertPathBuilderException08() {
-        CertPathBuilderException tE = new CertPathBuilderException(null, tCause);
-        if (tE.getMessage() != null) {
-            String toS = tCause.toString();
-            String getM = tE.getMessage();
-            assertTrue("getMessage() must should ".concat(toS), (getM
-                    .indexOf(toS) != -1));
-        }
-        assertNotNull("getCause() must not return null", tE.getCause());
-        assertEquals("getCause() must return ".concat(tCause.toString()), tE
-                .getCause(), tCause);
-        try {
-            throw tE;
-        } catch (Exception e) {
-            assertTrue(createErr(tE, e), tE.equals(e));
-        }
-    }
-
-    /**
-     * Test for <code>CertPathBuilderException(String, Throwable)</code>
-     * constructor Assertion: constructs CertPathBuilderException when
-     * <code>cause</code> is not null <code>msg</code> is not null
-     */
-    public void testCertPathBuilderException09() {
-        CertPathBuilderException tE;
-        for (int i = 0; i < msgs.length; i++) {
-            tE = new CertPathBuilderException(msgs[i], tCause);
-            String getM = tE.getMessage();
-            String toS = tCause.toString();
-            if (msgs[i].length() > 0) {
-                assertTrue("getMessage() must contain ".concat(msgs[i]), getM
-                        .indexOf(msgs[i]) != -1);
-                if (!getM.equals(msgs[i])) {
-                    assertTrue("getMessage() should contain ".concat(toS), getM
-                            .indexOf(toS) != -1);
-                }
-            }
-            assertNotNull("getCause() must not return null", tE.getCause());
-            assertEquals("getCause() must return ".concat(tCause.toString()),
-                    tE.getCause(), tCause);
-
-            try {
-                throw tE;
-            } catch (Exception e) {
-                assertTrue(createErr(tE, e), tE.equals(e));
-            }
-        }
-    }
-}
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+* @author Vera Y. Petrashkova
+* @version $Revision$
+*/
+
+package org.apache.harmony.security.tests.java.security.cert;
+
+import java.security.cert.CertPathBuilderException;
+
+import junit.framework.TestCase;
+
+
+/**
+ * Tests for <code>CertPathBuilderException</code> class constructors and
+ * methods.
+ * 
+ */
+public class CertPathBuilderExceptionTest extends TestCase {
+
+    public static void main(String[] args) {
+    }
+
+    /**
+     * Constructor for CertPathBuilderExceptionTests.
+     * 
+     * @param arg0
+     */
+    public CertPathBuilderExceptionTest(String arg0) {
+        super(arg0);
+    }
+
+    private static String[] msgs = {
+            "",
+            "Check new message",
+            "Check new message Check new message Check new message Check new message Check new message" };
+
+    private static Throwable tCause = new Throwable("Throwable for exception");
+
+    static String createErr(Exception tE, Exception eE) {
+        return "CertPathBuilderException ".concat(tE.toString()).concat(
+                " is not equal to caught exception: ").concat(eE.toString());
+    }
+
+    /**
+     * Test for <code>CertPathBuilderException()</code> constructor Assertion:
+     * constructs CertPathBuilderException with no detail message
+     */
+    public void testCertPathBuilderException01() {
+        CertPathBuilderException tE = new CertPathBuilderException();
+        assertNull("getMessage() must return null.", tE.getMessage());
+        assertNull("getCause() must return null", tE.getCause());
+        try {
+            throw tE;
+        } catch (Exception e) {
+            assertTrue(createErr(tE, e), tE.equals(e));
+        }
+    }
+
+    /**
+     * Test for <code>CertPathBuilderException(String)</code> constructor
+     * Assertion: constructs CertPathBuilderException with detail message msg.
+     * Parameter <code>msg</code> is not null.
+     */
+    public void testCertPathBuilderException02() {
+        CertPathBuilderException tE;
+        for (int i = 0; i < msgs.length; i++) {
+            tE = new CertPathBuilderException(msgs[i]);
+            assertEquals("getMessage() must return: ".concat(msgs[i]), tE
+                    .getMessage(), msgs[i]);
+            assertNull("getCause() must return null", tE.getCause());
+            try {
+                throw tE;
+            } catch (Exception e) {
+                assertTrue(createErr(tE, e), tE.equals(e));
+            }
+        }
+    }
+
+    /**
+     * Test for <code>CertPathBuilderException(String)</code> constructor
+     * Assertion: constructs CertPathBuilderException when <code>msg</code> is
+     * null
+     */
+    public void testCertPathBuilderException03() {
+        String msg = null;
+        CertPathBuilderException tE = new CertPathBuilderException(msg);
+        assertNull("getMessage() must return null.", tE.getMessage());
+        assertNull("getCause() must return null", tE.getCause());
+        try {
+            throw tE;
+        } catch (Exception e) {
+            assertTrue(createErr(tE, e), tE.equals(e));
+        }
+    }
+
+    /**
+     * Test for <code>CertPathBuilderException(Throwable)</code> constructor
+     * Assertion: constructs CertPathBuilderException when <code>cause</code>
+     * is null
+     */
+    public void testCertPathBuilderException04() {
+        Throwable cause = null;
+        CertPathBuilderException tE = new CertPathBuilderException(cause);
+        assertNull("getMessage() must return null.", tE.getMessage());
+        assertNull("getCause() must return null", tE.getCause());
+        try {
+            throw tE;
+        } catch (Exception e) {
+            assertTrue(createErr(tE, e), tE.equals(e));
+        }
+    }
+
+    /**
+     * Test for <code>CertPathBuilderException(Throwable)</code> constructor
+     * Assertion: constructs CertPathBuilderException when <code>cause</code>
+     * is not null
+     */
+    public void testCertPathBuilderException05() {
+        CertPathBuilderException tE = new CertPathBuilderException(tCause);
+        if (tE.getMessage() != null) {
+            String toS = tCause.toString();
+            String getM = tE.getMessage();
+            assertTrue("getMessage() should contain ".concat(toS), (getM
+                    .indexOf(toS) != -1));
+        }
+        assertNotNull("getCause() must not return null", tE.getCause());
+        assertEquals("getCause() must return ".concat(tCause.toString()), tE
+                .getCause(), tCause);
+        try {
+            throw tE;
+        } catch (Exception e) {
+            assertTrue(createErr(tE, e), tE.equals(e));
+        }
+    }
+
+    /**
+     * Test for <code>CertPathBuilderException(String, Throwable)</code>
+     * constructor Assertion: constructs CertPathBuilderException when
+     * <code>cause</code> is null <code>msg</code> is null
+     */
+    public void testCertPathBuilderException06() {
+        CertPathBuilderException tE = new CertPathBuilderException(null, null);
+        assertNull("getMessage() must return null", tE.getMessage());
+        assertNull("getCause() must return null", tE.getCause());
+        try {
+            throw tE;
+        } catch (Exception e) {
+            assertTrue(createErr(tE, e), tE.equals(e));
+        }
+    }
+
+    /**
+     * Test for <code>CertPathBuilderException(String, Throwable)</code>
+     * constructor Assertion: constructs CertPathBuilderException when
+     * <code>cause</code> is null <code>msg</code> is not null
+     */
+    public void testCertPathBuilderException07() {
+        CertPathBuilderException tE;
+        for (int i = 0; i < msgs.length; i++) {
+            tE = new CertPathBuilderException(msgs[i], null);
+            assertEquals("getMessage() must return: ".concat(msgs[i]), tE
+                    .getMessage(), msgs[i]);
+            assertNull("getCause() must return null", tE.getCause());
+            try {
+                throw tE;
+            } catch (Exception e) {
+                assertTrue(createErr(tE, e), tE.equals(e));
+            }
+        }
+    }
+
+    /**
+     * Test for <code>CertPathBuilderException(String, Throwable)</code>
+     * constructor Assertion: constructs CertPathBuilderException when
+     * <code>cause</code> is not null <code>msg</code> is null
+     */
+    public void testCertPathBuilderException08() {
+        CertPathBuilderException tE = new CertPathBuilderException(null, tCause);
+        if (tE.getMessage() != null) {
+            String toS = tCause.toString();
+            String getM = tE.getMessage();
+            assertTrue("getMessage() must should ".concat(toS), (getM
+                    .indexOf(toS) != -1));
+        }
+        assertNotNull("getCause() must not return null", tE.getCause());
+        assertEquals("getCause() must return ".concat(tCause.toString()), tE
+                .getCause(), tCause);
+        try {
+            throw tE;
+        } catch (Exception e) {
+            assertTrue(createErr(tE, e), tE.equals(e));
+        }
+    }
+
+    /**
+     * Test for <code>CertPathBuilderException(String, Throwable)</code>
+     * constructor Assertion: constructs CertPathBuilderException when
+     * <code>cause</code> is not null <code>msg</code> is not null
+     */
+    public void testCertPathBuilderException09() {
+        CertPathBuilderException tE;
+        for (int i = 0; i < msgs.length; i++) {
+            tE = new CertPathBuilderException(msgs[i], tCause);
+            String getM = tE.getMessage();
+            String toS = tCause.toString();
+            if (msgs[i].length() > 0) {
+                assertTrue("getMessage() must contain ".concat(msgs[i]), getM
+                        .indexOf(msgs[i]) != -1);
+                if (!getM.equals(msgs[i])) {
+                    assertTrue("getMessage() should contain ".concat(toS), getM
+                            .indexOf(toS) != -1);
+                }
+            }
+            assertNotNull("getCause() must not return null", tE.getCause());
+            assertEquals("getCause() must return ".concat(tCause.toString()),
+                    tE.getCause(), tCause);
+
+            try {
+                throw tE;
+            } catch (Exception e) {
+                assertTrue(createErr(tE, e), tE.equals(e));
+            }
+        }
+    }
+}

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertPathBuilderSpiTest.java (from r414728, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/cert/CertPathBuilderSpiTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertPathBuilderSpiTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertPathBuilderSpiTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/cert/CertPathBuilderSpiTest.java&r1=414728&r2=415555&rev=415555&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/cert/CertPathBuilderSpiTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertPathBuilderSpiTest.java Tue Jun 20 01:11:04 2006
@@ -1,59 +1,66 @@
-/*
- *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-/**
-* @author Vera Y. Petrashkova
-* @version $Revision$
-*/
-
-package java.security.cert;
-
-import junit.framework.TestCase;
-import java.security.InvalidAlgorithmParameterException;
-
-/**
- * Tests for <code>CertPathBuilderSpi</code> class constructors and methods.
- * 
- */
-
-public class CertPathBuilderSpiTest extends TestCase {
-
-    /**
-     * Constructor for CertPathBuilderSpiTest.
-     * 
-     * @param arg0
-     */
-    public CertPathBuilderSpiTest(String arg0) {
-        super(arg0);
-    }
-
-    /**
-     * Test for <code>CertPathBuilderSpi</code> constructor Assertion:
-     * constructs CertPathBuilderSpi
-     */
-    public void testCertPathBuilderSpi01() throws CertPathBuilderException,
-            InvalidAlgorithmParameterException {
-        CertPathBuilderSpi certPathBuilder = new MyCertPathBuilderSpi();
-        CertPathParameters cpp = null;
-        try {
-            certPathBuilder.engineBuild(cpp);
-            fail("CertPathBuilderException must be thrown");
-        } catch (CertPathBuilderException e) {
-        }    
-        CertPathBuilderResult cpbResult = certPathBuilder.engineBuild(cpp);
-        assertNull("Not null CertPathBuilderResult", cpbResult);
-    }
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+* @author Vera Y. Petrashkova
+* @version $Revision$
+*/
+
+package org.apache.harmony.security.tests.java.security.cert;
+
+import java.security.InvalidAlgorithmParameterException;
+import java.security.cert.CertPathBuilderException;
+import java.security.cert.CertPathBuilderResult;
+import java.security.cert.CertPathBuilderSpi;
+import java.security.cert.CertPathParameters;
+
+import org.apache.harmony.security.tests.support.cert.MyCertPathBuilderSpi;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for <code>CertPathBuilderSpi</code> class constructors and methods.
+ * 
+ */
+
+public class CertPathBuilderSpiTest extends TestCase {
+
+    /**
+     * Constructor for CertPathBuilderSpiTest.
+     * 
+     * @param arg0
+     */
+    public CertPathBuilderSpiTest(String arg0) {
+        super(arg0);
+    }
+
+    /**
+     * Test for <code>CertPathBuilderSpi</code> constructor Assertion:
+     * constructs CertPathBuilderSpi
+     */
+    public void testCertPathBuilderSpi01() throws CertPathBuilderException,
+            InvalidAlgorithmParameterException {
+        CertPathBuilderSpi certPathBuilder = new MyCertPathBuilderSpi();
+        CertPathParameters cpp = null;
+        try {
+            certPathBuilder.engineBuild(cpp);
+            fail("CertPathBuilderException must be thrown");
+        } catch (CertPathBuilderException e) {
+        }    
+        CertPathBuilderResult cpbResult = certPathBuilder.engineBuild(cpp);
+        assertNull("Not null CertPathBuilderResult", cpbResult);
+    }
 }

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertPathTest.java (from r414728, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/cert/CertPathTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertPathTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertPathTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/cert/CertPathTest.java&r1=414728&r2=415555&rev=415555&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/cert/CertPathTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertPathTest.java Tue Jun 20 01:11:04 2006
@@ -19,12 +19,14 @@
 * @version $Revision$
 */
 
-package java.security.cert;
+package org.apache.harmony.security.tests.java.security.cert;
+
+import java.security.cert.CertPath;
+import java.security.cert.CertificateEncodingException;
 
 import org.apache.harmony.security.tests.support.cert.MyCertPath;
 
 import junit.framework.TestCase;
-
 
 /**
  * Tests for <code>CertPath</code> fields and methods

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertPathValidator1Test.java (from r414728, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/cert/CertPathValidator1Test.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertPathValidator1Test.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertPathValidator1Test.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/cert/CertPathValidator1Test.java&r1=414728&r2=415555&rev=415555&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/cert/CertPathValidator1Test.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertPathValidator1Test.java Tue Jun 20 01:11:04 2006
@@ -1,406 +1,409 @@
-/*
- *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-/**
-* @author Vera Y. Petrashkova
-* @version $Revision$
-*/
-
-package java.security.cert;
-
-import java.security.InvalidAlgorithmParameterException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.Provider;
-import java.security.Security;
-
-import org.apache.harmony.security.tests.support.SpiEngUtils;
-import org.apache.harmony.security.tests.support.cert.MyCertPath;
-
-import junit.framework.TestCase;
-
-
-
-
-/**
- * Tests for <code>CertPathValidator</code> class constructors and
- * methods.
- * 
- */
-
-public class CertPathValidator1Test extends TestCase {
-
-    /**
-     * Constructor for CertPathValidatorTests.
-     * @param name
-     */
-    public CertPathValidator1Test(String name) {
-        super(name);
-    }
-    public static final String srvCertPathValidator = "CertPathValidator";
-    
-    private static final String defaultType = "PKIX";    
-    public static final String [] validValues = {
-            "PKIX", "pkix", "PkiX", "pKiX" };
-     
-    private static String [] invalidValues = SpiEngUtils.invalidValues;
-    
-    private static boolean PKIXSupport = false;
-
-    private static Provider defaultProvider;
-    private static String defaultProviderName;
-    
-    private static String NotSupportMsg = "";
-
-    static {
-        defaultProvider = SpiEngUtils.isSupport(defaultType,
-                srvCertPathValidator);
-        PKIXSupport = (defaultProvider != null);
-        defaultProviderName = (PKIXSupport ? defaultProvider.getName() : null);
-        NotSupportMsg = defaultType.concat(" is not supported");
-    }    
-    
-    
-    
-    private static CertPathValidator[] createCPVs() {
-        if (!PKIXSupport) {
-            fail(NotSupportMsg);
-            return null;
-        }
-        try {
-            CertPathValidator[] certPVs = new CertPathValidator[3];
-            certPVs[0] = CertPathValidator.getInstance(defaultType);
-            certPVs[1] = CertPathValidator.getInstance(defaultType,
-                    defaultProviderName);
-            certPVs[2] = CertPathValidator.getInstance(defaultType,
-                    defaultProvider);
-            return certPVs;
-        } catch (Exception e) {
-            return null;
-        }
-    }    
-    
-    
-    /**
-     * Test for <code>getDefaultType()</code> method
-	 * Assertion: returns security property "certpathvalidator.type" or "PKIX"
-     */    
-    public void testCertPathValidator01() {
-        if (!PKIXSupport) {
-            fail(NotSupportMsg);
-            return;
-        }
-        String propName = "certpathvalidator.type";
-        String defCPV = Security.getProperty(propName);
-        
-        String dt = CertPathValidator.getDefaultType();
-        String resType = defCPV; 
-        if (resType == null) {
-            resType = defaultType;
-        }
-        assertNotNull("Default type have not be null", dt);
-        assertEquals("Incorrect default type", dt, resType);
-        
-        if (defCPV == null) {
-            Security.setProperty(propName, defaultType);
-            dt = CertPathValidator.getDefaultType();
-            resType = Security.getProperty(propName);
-            assertNotNull("Incorrect default type", resType);
-            assertNotNull("Default type have not be null", dt);
-            assertEquals("Incorrect default type", dt, resType);            
-        }
-    }
-    
-    /**
-     * Test for <code>getInstance(String algorithm)</code> method
-	 * Assertion: 
-	 * throws NullPointerException when algorithm is null 
-	 * throws NoSuchAlgorithmException when algorithm  is not available
-     */
-    public void testCertPathValidator02() {
-        try {
-            CertPathValidator.getInstance(null);
-            fail("NullPointerException or NoSuchAlgorithmException must be thrown when algorithm is null");
-        } catch (NullPointerException e) {
-        } catch (NoSuchAlgorithmException e) {
-        }
-        for (int i = 0; i < invalidValues.length; i++) {
-            try {
-                CertPathValidator.getInstance(invalidValues[i]);
-                fail("NoSuchAlgorithmException must be thrown");
-            } catch (NoSuchAlgorithmException e) {
-            }
-        }
-    }   
-    /**
-     * Test for <code>getInstance(String algorithm)</code> method
-	 * Assertion: returns CertPathValidator object
-     */ 
-    public void testCertPathValidator03() throws NoSuchAlgorithmException  {
-        if (!PKIXSupport) {
-            fail(NotSupportMsg);
-            return;
-        }
-        CertPathValidator certPV;
-        for (int i = 0; i < validValues.length; i++) {
-            certPV = CertPathValidator.getInstance(validValues[i]);
-            assertEquals("Incorrect algorithm", certPV.getAlgorithm(), validValues[i]);
-        }
-    }
-    /**
-     * Test for <code>getInstance(String algorithm, String provider)</code> method
-	 * Assertion: throws IllegalArgumentException when provider is null or empty
-	 * 
-	 * FIXME: verify what exception will be thrown if provider is empty
-     */  
-    public void testCertPathValidator04()
-            throws NoSuchAlgorithmException, NoSuchProviderException  {
-        if (!PKIXSupport) {
-            fail(NotSupportMsg);
-            return;
-        }
-        String provider = null;
-        for (int i = 0; i < validValues.length; i++) {        
-            try {
-                CertPathValidator.getInstance(validValues[i], provider);
-                fail("IllegalArgumentException must be thrown thrown");
-            } catch (IllegalArgumentException e) {
-            }
-            try {
-                CertPathValidator.getInstance(validValues[i], "");
-                fail("IllegalArgumentException must be thrown thrown");
-            } catch (IllegalArgumentException e) {
-            }
-        }
-    }
-    /**
-     * Test for <code>getInstance(String algorithm, String provider)</code> method
-	 * Assertion: 
-	 * throws NoSuchProviderException when provider has invalid value
-     */
-    public void testCertPathValidator05() throws NoSuchAlgorithmException {
-        if (!PKIXSupport) {
-            fail(NotSupportMsg);
-            return;
-        }
-        for (int t = 0; t < validValues.length; t++) {
-            for (int i = 1; i < invalidValues.length; i++) {
-                try {
-                    CertPathValidator.getInstance(validValues[t],
-                            invalidValues[i]);
-                    fail("NoSuchProviderException must be thrown");
-                } catch (NoSuchProviderException e1) {
-                }
-            }
-        }
-    }
-    
-    /**
-     * Test for <code>getInstance(String algorithm, String provider)</code> method
-	 * Assertion: 
-	 * throws NullPointerException when algorithm is null 
-	 * throws NoSuchAlgorithmException when algorithm  is not available
-     */
-    public void testCertPathValidator06()
-            throws NoSuchAlgorithmException, NoSuchProviderException  {
-        if (!PKIXSupport) {
-            fail(NotSupportMsg);
-            return;
-        }
-        try {
-            CertPathValidator.getInstance(null, defaultProviderName);
-            fail("NullPointerException or NoSuchAlgorithmException must be thrown when algorithm is null");
-        } catch (NullPointerException e) {
-        } catch (NoSuchAlgorithmException e) {
-        }
-        for (int i = 0; i < invalidValues.length; i++) {
-            try {
-                CertPathValidator.getInstance(invalidValues[i], defaultProviderName);
-                fail("NoSuchAlgorithmException must be thrown");
-            } catch (NoSuchAlgorithmException e1) {
-            }
-        }
-    }
-    /**
-     * Test for <code>getInstance(String algorithm, String provider)</code> method
-	 * Assertion: returns CertPathValidator object
-     */
-    public void testCertPathValidator07() throws NoSuchAlgorithmException,
-            NoSuchProviderException {
-        if (!PKIXSupport) {
-            fail(NotSupportMsg);
-            return;
-        }
-        CertPathValidator certPV;
-        for (int i = 0; i < validValues.length; i++) {
-            certPV = CertPathValidator.getInstance(validValues[i],
-                    defaultProviderName);
-            assertEquals("Incorrect algorithm", certPV.getAlgorithm(),
-                    validValues[i]);
-            assertEquals("Incorrect provider name", certPV.getProvider()
-                    .getName(), defaultProviderName);
-        }
-    }
-    
-    /**
-     * Test for <code>getInstance(String algorithm, Provider provider)</code> method
-	 * Assertion: throws IllegalArgumentException when provider is null
-     */
-    public void testCertPathValidator08()
-            throws NoSuchAlgorithmException  {
-        if (!PKIXSupport) {
-            fail(NotSupportMsg);
-            return;
-        }
-        Provider prov = null;
-        for (int t = 0; t < validValues.length; t++ ) {
-            try {
-                CertPathValidator.getInstance(validValues[t], prov);
-                fail("IllegalArgumentException must be thrown");
-            } catch (IllegalArgumentException e1) {
-            }
-        }        
-    }
-    
-    /**
-     * Test for <code>getInstance(String algorithm, String provider)</code> method
-	 * Assertion: 
-	 * throws NullPointerException when algorithm is null 
-	 * throws NoSuchAlgorithmException when algorithm  is not available
-     */
-    public void testCertPathValidator09()
-            throws NoSuchAlgorithmException, NoSuchProviderException  {
-        if (!PKIXSupport) {
-            fail(NotSupportMsg);
-            return;
-        }
-        try {
-            CertPathValidator.getInstance(null, defaultProvider);
-            fail("NullPointerException or NoSuchAlgorithmException must be thrown when algorithm is null");
-        } catch (NullPointerException e) {
-        } catch (NoSuchAlgorithmException e) {
-        }
-        for (int i = 0; i < invalidValues.length; i++) {
-            try {
-                CertPathValidator.getInstance(invalidValues[i], defaultProvider);
-                fail("NoSuchAlgorithm must be thrown");
-            } catch (NoSuchAlgorithmException e1) {
-            }
-        }
-    }
-    /**
-     * Test for <code>getInstance(String algorithm, String provider)</code> method
-	 * Assertion: returns CertPathValidator object
-     */
-    public void testCertPathValidator10() throws NoSuchAlgorithmException,
-            NoSuchProviderException {
-        if (!PKIXSupport) {
-            fail(NotSupportMsg);
-            return;
-        }
-        CertPathValidator certPV;
-        for (int i = 0; i < invalidValues.length; i++) {
-            certPV = CertPathValidator.getInstance(validValues[i],
-                    defaultProvider);
-            assertEquals("Incorrect algorithm", certPV.getAlgorithm(),
-                    validValues[i]);
-            assertEquals("Incorrect provider name", certPV.getProvider(),
-                    defaultProvider);
-        }
-    }
-
-    /**
-     * Test for <code>validate(CertPath certpath, CertPathParameters params)</code> method
-	 * Assertion: throws InvalidAlgorithmParameterException params is not
-	 * instance of PKIXParameters or null
-     */
-    public void testCertPathValidator11()
-            throws NoSuchAlgorithmException, NoSuchProviderException, CertPathValidatorException {
-        if (!PKIXSupport) {
-            fail(NotSupportMsg);
-            return;
-        }
-        CertPathValidator [] certPV = createCPVs();
-        assertNotNull("CertPathValidator objects were not created", certPV);
-        MyCertPath mCP = new MyCertPath(new byte[0]);
-        invalidParams mPar = new invalidParams();
-        for (int i = 0; i < certPV.length; i++) {
-            try {
-                certPV[i].validate(mCP, mPar);
-                fail("InvalidAlgorithmParameterException must be thrown");
-            } catch(InvalidAlgorithmParameterException e) {
-            }
-            try {
-                certPV[i].validate(mCP, null);
-                fail("InvalidAlgorithmParameterException must be thrown");
-            } catch(InvalidAlgorithmParameterException e) {
-            }
-        }
-    }
-    
-     /**
-     * Test for 
-     * <code>CertPathValidator</code> constructor
-     * Assertion: returns CertPathValidator object
-     */
-    public void testCertPathValidator12()
-            throws CertificateException, NoSuchProviderException, NoSuchAlgorithmException,
-            CertPathValidatorException, InvalidAlgorithmParameterException {
-        if (!PKIXSupport) {
-            fail(NotSupportMsg);
-            return;
-        }
-        CertPathValidatorSpi spi = new MyCertPathValidatorSpi();
-        CertPathValidator certPV = new myCertPathValidator(spi, 
-                    defaultProvider, defaultType);
-        assertEquals("Incorrect algorithm", certPV.getAlgorithm(), defaultType);
-        assertEquals("Incorrect provider", certPV.getProvider(), defaultProvider);
-        certPV.validate(null, null);
-        try {
-            certPV.validate(null, null);
-            fail("CertPathValidatorException must be thrown");
-        } catch (CertPathValidatorException e) {
-        }        
-        certPV = new myCertPathValidator(null, null, null);
-        assertEquals("Incorrect algorithm", certPV.getAlgorithm(), null);
-        assertEquals("Incorrect provider", certPV.getProvider(), null);
-        try {
-            certPV.validate(null, null);
-            fail("NullPointerException must be thrown");
-        } catch (NullPointerException e) {
-        }
-    }
-    public static void main(String args[]) {
-        junit.textui.TestRunner.run(CertPathValidator1Test.class);
-    }  
-}
-/**
- * Addifional class to verify CertPathValidator constructor
- */
-class myCertPathValidator extends CertPathValidator {
-
-    public myCertPathValidator(CertPathValidatorSpi spi, Provider prov, String type) {
-        super(spi, prov, type);
-    }
-}
-/**
- * Additional class to verify validate method
- */
-class invalidParams implements CertPathParameters {
-    public Object clone() {
-        return new invalidParams();
-    }
-}
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+* @author Vera Y. Petrashkova
+* @version $Revision$
+*/
+
+package org.apache.harmony.security.tests.java.security.cert;
+
+import java.security.InvalidAlgorithmParameterException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.Provider;
+import java.security.Security;
+import java.security.cert.CertPathParameters;
+import java.security.cert.CertPathValidator;
+import java.security.cert.CertPathValidatorException;
+import java.security.cert.CertPathValidatorSpi;
+import java.security.cert.CertificateException;
+
+import org.apache.harmony.security.tests.support.SpiEngUtils;
+import org.apache.harmony.security.tests.support.cert.MyCertPath;
+import org.apache.harmony.security.tests.support.cert.MyCertPathValidatorSpi;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for <code>CertPathValidator</code> class constructors and
+ * methods.
+ * 
+ */
+
+public class CertPathValidator1Test extends TestCase {
+
+    /**
+     * Constructor for CertPathValidatorTests.
+     * @param name
+     */
+    public CertPathValidator1Test(String name) {
+        super(name);
+    }
+    public static final String srvCertPathValidator = "CertPathValidator";
+    
+    private static final String defaultType = "PKIX";    
+    public static final String [] validValues = {
+            "PKIX", "pkix", "PkiX", "pKiX" };
+     
+    private static String [] invalidValues = SpiEngUtils.invalidValues;
+    
+    private static boolean PKIXSupport = false;
+
+    private static Provider defaultProvider;
+    private static String defaultProviderName;
+    
+    private static String NotSupportMsg = "";
+
+    static {
+        defaultProvider = SpiEngUtils.isSupport(defaultType,
+                srvCertPathValidator);
+        PKIXSupport = (defaultProvider != null);
+        defaultProviderName = (PKIXSupport ? defaultProvider.getName() : null);
+        NotSupportMsg = defaultType.concat(" is not supported");
+    }    
+    
+    
+    
+    private static CertPathValidator[] createCPVs() {
+        if (!PKIXSupport) {
+            fail(NotSupportMsg);
+            return null;
+        }
+        try {
+            CertPathValidator[] certPVs = new CertPathValidator[3];
+            certPVs[0] = CertPathValidator.getInstance(defaultType);
+            certPVs[1] = CertPathValidator.getInstance(defaultType,
+                    defaultProviderName);
+            certPVs[2] = CertPathValidator.getInstance(defaultType,
+                    defaultProvider);
+            return certPVs;
+        } catch (Exception e) {
+            return null;
+        }
+    }    
+    
+    
+    /**
+     * Test for <code>getDefaultType()</code> method
+	 * Assertion: returns security property "certpathvalidator.type" or "PKIX"
+     */    
+    public void testCertPathValidator01() {
+        if (!PKIXSupport) {
+            fail(NotSupportMsg);
+            return;
+        }
+        String propName = "certpathvalidator.type";
+        String defCPV = Security.getProperty(propName);
+        
+        String dt = CertPathValidator.getDefaultType();
+        String resType = defCPV; 
+        if (resType == null) {
+            resType = defaultType;
+        }
+        assertNotNull("Default type have not be null", dt);
+        assertEquals("Incorrect default type", dt, resType);
+        
+        if (defCPV == null) {
+            Security.setProperty(propName, defaultType);
+            dt = CertPathValidator.getDefaultType();
+            resType = Security.getProperty(propName);
+            assertNotNull("Incorrect default type", resType);
+            assertNotNull("Default type have not be null", dt);
+            assertEquals("Incorrect default type", dt, resType);            
+        }
+    }
+    
+    /**
+     * Test for <code>getInstance(String algorithm)</code> method
+	 * Assertion: 
+	 * throws NullPointerException when algorithm is null 
+	 * throws NoSuchAlgorithmException when algorithm  is not available
+     */
+    public void testCertPathValidator02() {
+        try {
+            CertPathValidator.getInstance(null);
+            fail("NullPointerException or NoSuchAlgorithmException must be thrown when algorithm is null");
+        } catch (NullPointerException e) {
+        } catch (NoSuchAlgorithmException e) {
+        }
+        for (int i = 0; i < invalidValues.length; i++) {
+            try {
+                CertPathValidator.getInstance(invalidValues[i]);
+                fail("NoSuchAlgorithmException must be thrown");
+            } catch (NoSuchAlgorithmException e) {
+            }
+        }
+    }   
+    /**
+     * Test for <code>getInstance(String algorithm)</code> method
+	 * Assertion: returns CertPathValidator object
+     */ 
+    public void testCertPathValidator03() throws NoSuchAlgorithmException  {
+        if (!PKIXSupport) {
+            fail(NotSupportMsg);
+            return;
+        }
+        CertPathValidator certPV;
+        for (int i = 0; i < validValues.length; i++) {
+            certPV = CertPathValidator.getInstance(validValues[i]);
+            assertEquals("Incorrect algorithm", certPV.getAlgorithm(), validValues[i]);
+        }
+    }
+    /**
+     * Test for <code>getInstance(String algorithm, String provider)</code> method
+	 * Assertion: throws IllegalArgumentException when provider is null or empty
+	 * 
+	 * FIXME: verify what exception will be thrown if provider is empty
+     */  
+    public void testCertPathValidator04()
+            throws NoSuchAlgorithmException, NoSuchProviderException  {
+        if (!PKIXSupport) {
+            fail(NotSupportMsg);
+            return;
+        }
+        String provider = null;
+        for (int i = 0; i < validValues.length; i++) {        
+            try {
+                CertPathValidator.getInstance(validValues[i], provider);
+                fail("IllegalArgumentException must be thrown thrown");
+            } catch (IllegalArgumentException e) {
+            }
+            try {
+                CertPathValidator.getInstance(validValues[i], "");
+                fail("IllegalArgumentException must be thrown thrown");
+            } catch (IllegalArgumentException e) {
+            }
+        }
+    }
+    /**
+     * Test for <code>getInstance(String algorithm, String provider)</code> method
+	 * Assertion: 
+	 * throws NoSuchProviderException when provider has invalid value
+     */
+    public void testCertPathValidator05() throws NoSuchAlgorithmException {
+        if (!PKIXSupport) {
+            fail(NotSupportMsg);
+            return;
+        }
+        for (int t = 0; t < validValues.length; t++) {
+            for (int i = 1; i < invalidValues.length; i++) {
+                try {
+                    CertPathValidator.getInstance(validValues[t],
+                            invalidValues[i]);
+                    fail("NoSuchProviderException must be thrown");
+                } catch (NoSuchProviderException e1) {
+                }
+            }
+        }
+    }
+    
+    /**
+     * Test for <code>getInstance(String algorithm, String provider)</code> method
+	 * Assertion: 
+	 * throws NullPointerException when algorithm is null 
+	 * throws NoSuchAlgorithmException when algorithm  is not available
+     */
+    public void testCertPathValidator06()
+            throws NoSuchAlgorithmException, NoSuchProviderException  {
+        if (!PKIXSupport) {
+            fail(NotSupportMsg);
+            return;
+        }
+        try {
+            CertPathValidator.getInstance(null, defaultProviderName);
+            fail("NullPointerException or NoSuchAlgorithmException must be thrown when algorithm is null");
+        } catch (NullPointerException e) {
+        } catch (NoSuchAlgorithmException e) {
+        }
+        for (int i = 0; i < invalidValues.length; i++) {
+            try {
+                CertPathValidator.getInstance(invalidValues[i], defaultProviderName);
+                fail("NoSuchAlgorithmException must be thrown");
+            } catch (NoSuchAlgorithmException e1) {
+            }
+        }
+    }
+    /**
+     * Test for <code>getInstance(String algorithm, String provider)</code> method
+	 * Assertion: returns CertPathValidator object
+     */
+    public void testCertPathValidator07() throws NoSuchAlgorithmException,
+            NoSuchProviderException {
+        if (!PKIXSupport) {
+            fail(NotSupportMsg);
+            return;
+        }
+        CertPathValidator certPV;
+        for (int i = 0; i < validValues.length; i++) {
+            certPV = CertPathValidator.getInstance(validValues[i],
+                    defaultProviderName);
+            assertEquals("Incorrect algorithm", certPV.getAlgorithm(),
+                    validValues[i]);
+            assertEquals("Incorrect provider name", certPV.getProvider()
+                    .getName(), defaultProviderName);
+        }
+    }
+    
+    /**
+     * Test for <code>getInstance(String algorithm, Provider provider)</code> method
+	 * Assertion: throws IllegalArgumentException when provider is null
+     */
+    public void testCertPathValidator08()
+            throws NoSuchAlgorithmException  {
+        if (!PKIXSupport) {
+            fail(NotSupportMsg);
+            return;
+        }
+        Provider prov = null;
+        for (int t = 0; t < validValues.length; t++ ) {
+            try {
+                CertPathValidator.getInstance(validValues[t], prov);
+                fail("IllegalArgumentException must be thrown");
+            } catch (IllegalArgumentException e1) {
+            }
+        }        
+    }
+    
+    /**
+     * Test for <code>getInstance(String algorithm, String provider)</code> method
+	 * Assertion: 
+	 * throws NullPointerException when algorithm is null 
+	 * throws NoSuchAlgorithmException when algorithm  is not available
+     */
+    public void testCertPathValidator09()
+            throws NoSuchAlgorithmException, NoSuchProviderException  {
+        if (!PKIXSupport) {
+            fail(NotSupportMsg);
+            return;
+        }
+        try {
+            CertPathValidator.getInstance(null, defaultProvider);
+            fail("NullPointerException or NoSuchAlgorithmException must be thrown when algorithm is null");
+        } catch (NullPointerException e) {
+        } catch (NoSuchAlgorithmException e) {
+        }
+        for (int i = 0; i < invalidValues.length; i++) {
+            try {
+                CertPathValidator.getInstance(invalidValues[i], defaultProvider);
+                fail("NoSuchAlgorithm must be thrown");
+            } catch (NoSuchAlgorithmException e1) {
+            }
+        }
+    }
+    /**
+     * Test for <code>getInstance(String algorithm, String provider)</code> method
+	 * Assertion: returns CertPathValidator object
+     */
+    public void testCertPathValidator10() throws NoSuchAlgorithmException,
+            NoSuchProviderException {
+        if (!PKIXSupport) {
+            fail(NotSupportMsg);
+            return;
+        }
+        CertPathValidator certPV;
+        for (int i = 0; i < invalidValues.length; i++) {
+            certPV = CertPathValidator.getInstance(validValues[i],
+                    defaultProvider);
+            assertEquals("Incorrect algorithm", certPV.getAlgorithm(),
+                    validValues[i]);
+            assertEquals("Incorrect provider name", certPV.getProvider(),
+                    defaultProvider);
+        }
+    }
+
+    /**
+     * Test for <code>validate(CertPath certpath, CertPathParameters params)</code> method
+	 * Assertion: throws InvalidAlgorithmParameterException params is not
+	 * instance of PKIXParameters or null
+     */
+    public void testCertPathValidator11()
+            throws NoSuchAlgorithmException, NoSuchProviderException, CertPathValidatorException {
+        if (!PKIXSupport) {
+            fail(NotSupportMsg);
+            return;
+        }
+        CertPathValidator [] certPV = createCPVs();
+        assertNotNull("CertPathValidator objects were not created", certPV);
+        MyCertPath mCP = new MyCertPath(new byte[0]);
+        invalidParams mPar = new invalidParams();
+        for (int i = 0; i < certPV.length; i++) {
+            try {
+                certPV[i].validate(mCP, mPar);
+                fail("InvalidAlgorithmParameterException must be thrown");
+            } catch(InvalidAlgorithmParameterException e) {
+            }
+            try {
+                certPV[i].validate(mCP, null);
+                fail("InvalidAlgorithmParameterException must be thrown");
+            } catch(InvalidAlgorithmParameterException e) {
+            }
+        }
+    }
+    
+     /**
+     * Test for 
+     * <code>CertPathValidator</code> constructor
+     * Assertion: returns CertPathValidator object
+     */
+    public void testCertPathValidator12()
+            throws CertificateException, NoSuchProviderException, NoSuchAlgorithmException,
+            CertPathValidatorException, InvalidAlgorithmParameterException {
+        if (!PKIXSupport) {
+            fail(NotSupportMsg);
+            return;
+        }
+        CertPathValidatorSpi spi = new MyCertPathValidatorSpi();
+        CertPathValidator certPV = new myCertPathValidator(spi, 
+                    defaultProvider, defaultType);
+        assertEquals("Incorrect algorithm", certPV.getAlgorithm(), defaultType);
+        assertEquals("Incorrect provider", certPV.getProvider(), defaultProvider);
+        certPV.validate(null, null);
+        try {
+            certPV.validate(null, null);
+            fail("CertPathValidatorException must be thrown");
+        } catch (CertPathValidatorException e) {
+        }        
+        certPV = new myCertPathValidator(null, null, null);
+        assertEquals("Incorrect algorithm", certPV.getAlgorithm(), null);
+        assertEquals("Incorrect provider", certPV.getProvider(), null);
+        try {
+            certPV.validate(null, null);
+            fail("NullPointerException must be thrown");
+        } catch (NullPointerException e) {
+        }
+    }
+    public static void main(String args[]) {
+        junit.textui.TestRunner.run(CertPathValidator1Test.class);
+    }  
+}
+/**
+ * Addifional class to verify CertPathValidator constructor
+ */
+class myCertPathValidator extends CertPathValidator {
+
+    public myCertPathValidator(CertPathValidatorSpi spi, Provider prov, String type) {
+        super(spi, prov, type);
+    }
+}
+/**
+ * Additional class to verify validate method
+ */
+class invalidParams implements CertPathParameters {
+    public Object clone() {
+        return new invalidParams();
+    }
+}

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertPathValidator2Test.java (from r414728, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/cert/CertPathValidator2Test.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertPathValidator2Test.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertPathValidator2Test.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/cert/CertPathValidator2Test.java&r1=414728&r2=415555&rev=415555&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/cert/CertPathValidator2Test.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertPathValidator2Test.java Tue Jun 20 01:11:04 2006
@@ -1,248 +1,251 @@
-/*
- *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-/**
-* @author Vera Y. Petrashkova
-* @version $Revision$
-*/
-
-package java.security.cert;
-
-import java.security.InvalidAlgorithmParameterException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.Provider;
-import java.security.Security;
-
-import org.apache.harmony.security.tests.support.SpiEngUtils;
-
-import junit.framework.TestCase;
-
-
-/**
- * Tests for CertPathValidator class constructors and methods
- * 
- */
-
-public class CertPathValidator2Test extends TestCase {
-    private static final String defaultAlg = "CertPB";
-    
-    public static final String CertPathValidatorProviderClass = "java.security.cert.MyCertPathValidatorSpi";
-
-    private static final String[] invalidValues = SpiEngUtils.invalidValues;
-
-    private static final String[] validValues;
-
-    static {
-        validValues = new String[4];
-        validValues[0] = defaultAlg;
-        validValues[1] = defaultAlg.toLowerCase();
-        validValues[2] = "CeRtPb";
-        validValues[3] = "cERTpb";
-    }
-
-    Provider mProv;
-
-    protected void setUp() throws Exception {
-        super.setUp();
-        mProv = (new SpiEngUtils()).new MyProvider("MyCertPathValidatorProvider",
-                "Provider for testing", CertPathValidator1Test.srvCertPathValidator
-                        .concat(".").concat(defaultAlg),
-                CertPathValidatorProviderClass);
-        Security.insertProviderAt(mProv, 1);
-    }
-
-    /*
-     * @see TestCase#tearDown()
-     */
-    protected void tearDown() throws Exception {
-        super.tearDown();
-        Security.removeProvider(mProv.getName());
-    }
-
-    /**
-     * Constructor for CertPathValidator2Test.
-     * 
-     * @param arg0
-     */
-    public CertPathValidator2Test(String arg0) {
-        super(arg0);
-    }
-
-    private void checkResult(CertPathValidator certV) 
-            throws CertPathValidatorException, 
-            InvalidAlgorithmParameterException {
-        String dt = CertPathValidator.getDefaultType();
-        String propName = "certpathvalidator.type";
-        for (int i = 0; i <invalidValues.length; i++) {
-            Security.setProperty(propName, invalidValues[i]);
-            assertEquals("Incorrect default type", CertPathValidator.getDefaultType(),
-                    invalidValues[i]);
-        }
-        Security.setProperty(propName, dt);
-        assertEquals("Incorrect default type", CertPathValidator.getDefaultType(),
-                dt);       certV.validate(null, null);
-       try {
-           certV.validate(null, null);           
-       } catch (CertPathValidatorException e) {
-       }
-       try {
-           certV.validate(null, null);           
-       } catch (InvalidAlgorithmParameterException e) {
-       }
-    }
-
-    /**
-     * Test for <code>getInstance(String algorithm)</code> method 
-     * Assertions:
-	 * throws NullPointerException when algorithm is null 
-	 * throws NoSuchAlgorithmException when algorithm  is not available
-     * returns CertPathValidator object
-     */
-    public void testGetInstance01() throws NoSuchAlgorithmException,
-            InvalidAlgorithmParameterException, CertPathValidatorException {
-        try {
-            CertPathValidator.getInstance(null);
-            fail("NullPointerException or NoSuchAlgorithmException must be thrown when algorithm is null");
-        } catch (NullPointerException e) {
-        } catch (NoSuchAlgorithmException e) {
-        }
-        for (int i = 0; i < invalidValues.length; i++) {
-            try {
-                CertPathValidator.getInstance(invalidValues[i]);
-                fail("NoSuchAlgorithmException must be thrown (type: ".concat(
-                        invalidValues[i]).concat(")"));
-            } catch (NoSuchAlgorithmException e) {
-            }
-        }
-        CertPathValidator cerPV;
-        for (int i = 0; i < validValues.length; i++) {
-            cerPV = CertPathValidator.getInstance(validValues[i]);
-            assertEquals("Incorrect type", cerPV.getAlgorithm(), validValues[i]);
-            assertEquals("Incorrect provider", cerPV.getProvider(), mProv);
-            checkResult(cerPV);
-        }
-    }
-
-    /**
-     * Test for <code>getInstance(String algorithm, String provider)</code> method
-     * Assertions: 
-	 * throws NullPointerException when algorithm is null 
-	 * throws NoSuchAlgorithmException when algorithm  is not available
-     * throws IllegalArgumentException when provider is null or empty; 
-     * throws NoSuchProviderException when provider is available; 
-     * returns CertPathValidator object
-     */
-    public void testGetInstance02() throws NoSuchAlgorithmException,
-            NoSuchProviderException, IllegalArgumentException,
-            InvalidAlgorithmParameterException, CertPathValidatorException {
-        try {
-            CertPathValidator.getInstance(null, mProv.getName());
-            fail("NullPointerException or NoSuchAlgorithmException must be thrown when algorithm is null");
-        } catch (NullPointerException e) {
-        } catch (NoSuchAlgorithmException e) {
-        }
-        for (int i = 0; i < invalidValues.length; i++) {
-            try {
-                CertPathValidator.getInstance(invalidValues[i], mProv
-                        .getName());
-                fail("NoSuchAlgorithmException must be thrown (type: ".concat(
-                        invalidValues[i]).concat(")"));
-            } catch (NoSuchAlgorithmException e) {
-            }
-        }
-        String prov = null;
-        for (int i = 0; i < validValues.length; i++) {
-            try {
-                CertPathValidator.getInstance(validValues[i], prov);
-                fail("IllegalArgumentException must be thrown when provider is null (type: "
-                        .concat(validValues[i]).concat(")"));
-            } catch (IllegalArgumentException e) {
-            }
-            try {
-                CertPathValidator.getInstance(validValues[i], "");
-                fail("IllegalArgumentException must be thrown when provider is empty (type: "
-                        .concat(validValues[i]).concat(")"));
-            } catch (IllegalArgumentException e) {
-            }
-        }
-        for (int i = 0; i < validValues.length; i++) {
-            for (int j = 1; j < invalidValues.length; j++) {
-                try {
-                    CertPathValidator.getInstance(validValues[i],
-                            invalidValues[j]);
-                    fail("NoSuchProviderException must be thrown (type: "
-                            .concat(validValues[i]).concat(" provider: ")
-                            .concat(invalidValues[j]).concat(")"));
-                } catch (NoSuchProviderException e) {
-                }
-            }
-        }
-        CertPathValidator cerPV;
-        for (int i = 0; i < validValues.length; i++) {
-            cerPV = CertPathValidator.getInstance(validValues[i], mProv
-                    .getName());
-            assertEquals("Incorrect type", cerPV.getAlgorithm(), validValues[i]);
-            assertEquals("Incorrect provider", cerPV.getProvider().getName(),
-                    mProv.getName());
-            checkResult(cerPV);
-        }
-    }
-
-    /**
-     * Test for <code>getInstance(String algorithm, Provider provider)</code>
-     * method 
-     * Assertions: 
-	 * throws NullPointerException when algorithm is null 
-	 * throws NoSuchAlgorithmException when algorithm  is not available
-     * throws IllegalArgumentException when provider is null; 
-     * returns CertPathValidator object
-     */
-    public void testGetInstance03() throws NoSuchAlgorithmException,
-            IllegalArgumentException,
-            InvalidAlgorithmParameterException, CertPathValidatorException {
-        try {
-            CertPathValidator.getInstance(null, mProv);
-            fail("NullPointerException or NoSuchAlgorithmException must be thrown when algorithm is null");
-        } catch (NullPointerException e) {
-        } catch (NoSuchAlgorithmException e) {
-        }
-        for (int i = 0; i < invalidValues.length; i++) {
-            try {
-                CertPathValidator.getInstance(invalidValues[i], mProv);
-                fail("NoSuchAlgorithmException must be thrown (type: ".concat(
-                        invalidValues[i]).concat(")"));
-            } catch (NoSuchAlgorithmException e) {
-            }
-        }
-        Provider prov = null;
-        for (int i = 0; i < validValues.length; i++) {
-            try {
-                CertPathValidator.getInstance(validValues[i], prov);
-                fail("IllegalArgumentException must be thrown when provider is null (type: "
-                        .concat(validValues[i]).concat(")"));
-            } catch (IllegalArgumentException e) {
-            }
-        }
-        CertPathValidator cerPV;
-        for (int i = 0; i < validValues.length; i++) {
-            cerPV = CertPathValidator.getInstance(validValues[i], mProv);
-            assertEquals("Incorrect type", cerPV.getAlgorithm(), validValues[i]);
-            assertEquals("Incorrect provider", cerPV.getProvider(), mProv);
-            checkResult(cerPV);
-        }
-    }
-}
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+* @author Vera Y. Petrashkova
+* @version $Revision$
+*/
+
+package org.apache.harmony.security.tests.java.security.cert;
+
+import java.security.InvalidAlgorithmParameterException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.Provider;
+import java.security.Security;
+import java.security.cert.CertPathValidator;
+import java.security.cert.CertPathValidatorException;
+
+import org.apache.harmony.security.tests.java.security.cert.CertPathValidator1Test;
+import org.apache.harmony.security.tests.support.SpiEngUtils;
+import org.apache.harmony.security.tests.support.SpiEngUtils.MyProvider;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for CertPathValidator class constructors and methods
+ * 
+ */
+
+public class CertPathValidator2Test extends TestCase {
+    private static final String defaultAlg = "CertPB";
+    
+    public static final String CertPathValidatorProviderClass = "org.apache.harmony.security.tests.support.cert.MyCertPathValidatorSpi";
+
+    private static final String[] invalidValues = SpiEngUtils.invalidValues;
+
+    private static final String[] validValues;
+
+    static {
+        validValues = new String[4];
+        validValues[0] = defaultAlg;
+        validValues[1] = defaultAlg.toLowerCase();
+        validValues[2] = "CeRtPb";
+        validValues[3] = "cERTpb";
+    }
+
+    Provider mProv;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        mProv = (new SpiEngUtils()).new MyProvider("MyCertPathValidatorProvider",
+                "Provider for testing", CertPathValidator1Test.srvCertPathValidator
+                        .concat(".").concat(defaultAlg),
+                CertPathValidatorProviderClass);
+        Security.insertProviderAt(mProv, 1);
+    }
+
+    /*
+     * @see TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        Security.removeProvider(mProv.getName());
+    }
+
+    /**
+     * Constructor for CertPathValidator2Test.
+     * 
+     * @param arg0
+     */
+    public CertPathValidator2Test(String arg0) {
+        super(arg0);
+    }
+
+    private void checkResult(CertPathValidator certV) 
+            throws CertPathValidatorException, 
+            InvalidAlgorithmParameterException {
+        String dt = CertPathValidator.getDefaultType();
+        String propName = "certpathvalidator.type";
+        for (int i = 0; i <invalidValues.length; i++) {
+            Security.setProperty(propName, invalidValues[i]);
+            assertEquals("Incorrect default type", CertPathValidator.getDefaultType(),
+                    invalidValues[i]);
+        }
+        Security.setProperty(propName, dt);
+        assertEquals("Incorrect default type", CertPathValidator.getDefaultType(),
+                dt);       certV.validate(null, null);
+       try {
+           certV.validate(null, null);           
+       } catch (CertPathValidatorException e) {
+       }
+       try {
+           certV.validate(null, null);           
+       } catch (InvalidAlgorithmParameterException e) {
+       }
+    }
+
+    /**
+     * Test for <code>getInstance(String algorithm)</code> method 
+     * Assertions:
+	 * throws NullPointerException when algorithm is null 
+	 * throws NoSuchAlgorithmException when algorithm  is not available
+     * returns CertPathValidator object
+     */
+    public void testGetInstance01() throws NoSuchAlgorithmException,
+            InvalidAlgorithmParameterException, CertPathValidatorException {
+        try {
+            CertPathValidator.getInstance(null);
+            fail("NullPointerException or NoSuchAlgorithmException must be thrown when algorithm is null");
+        } catch (NullPointerException e) {
+        } catch (NoSuchAlgorithmException e) {
+        }
+        for (int i = 0; i < invalidValues.length; i++) {
+            try {
+                CertPathValidator.getInstance(invalidValues[i]);
+                fail("NoSuchAlgorithmException must be thrown (type: ".concat(
+                        invalidValues[i]).concat(")"));
+            } catch (NoSuchAlgorithmException e) {
+            }
+        }
+        CertPathValidator cerPV;
+        for (int i = 0; i < validValues.length; i++) {
+            cerPV = CertPathValidator.getInstance(validValues[i]);
+            assertEquals("Incorrect type", cerPV.getAlgorithm(), validValues[i]);
+            assertEquals("Incorrect provider", cerPV.getProvider(), mProv);
+            checkResult(cerPV);
+        }
+    }
+
+    /**
+     * Test for <code>getInstance(String algorithm, String provider)</code> method
+     * Assertions: 
+	 * throws NullPointerException when algorithm is null 
+	 * throws NoSuchAlgorithmException when algorithm  is not available
+     * throws IllegalArgumentException when provider is null or empty; 
+     * throws NoSuchProviderException when provider is available; 
+     * returns CertPathValidator object
+     */
+    public void testGetInstance02() throws NoSuchAlgorithmException,
+            NoSuchProviderException, IllegalArgumentException,
+            InvalidAlgorithmParameterException, CertPathValidatorException {
+        try {
+            CertPathValidator.getInstance(null, mProv.getName());
+            fail("NullPointerException or NoSuchAlgorithmException must be thrown when algorithm is null");
+        } catch (NullPointerException e) {
+        } catch (NoSuchAlgorithmException e) {
+        }
+        for (int i = 0; i < invalidValues.length; i++) {
+            try {
+                CertPathValidator.getInstance(invalidValues[i], mProv
+                        .getName());
+                fail("NoSuchAlgorithmException must be thrown (type: ".concat(
+                        invalidValues[i]).concat(")"));
+            } catch (NoSuchAlgorithmException e) {
+            }
+        }
+        String prov = null;
+        for (int i = 0; i < validValues.length; i++) {
+            try {
+                CertPathValidator.getInstance(validValues[i], prov);
+                fail("IllegalArgumentException must be thrown when provider is null (type: "
+                        .concat(validValues[i]).concat(")"));
+            } catch (IllegalArgumentException e) {
+            }
+            try {
+                CertPathValidator.getInstance(validValues[i], "");
+                fail("IllegalArgumentException must be thrown when provider is empty (type: "
+                        .concat(validValues[i]).concat(")"));
+            } catch (IllegalArgumentException e) {
+            }
+        }
+        for (int i = 0; i < validValues.length; i++) {
+            for (int j = 1; j < invalidValues.length; j++) {
+                try {
+                    CertPathValidator.getInstance(validValues[i],
+                            invalidValues[j]);
+                    fail("NoSuchProviderException must be thrown (type: "
+                            .concat(validValues[i]).concat(" provider: ")
+                            .concat(invalidValues[j]).concat(")"));
+                } catch (NoSuchProviderException e) {
+                }
+            }
+        }
+        CertPathValidator cerPV;
+        for (int i = 0; i < validValues.length; i++) {
+            cerPV = CertPathValidator.getInstance(validValues[i], mProv
+                    .getName());
+            assertEquals("Incorrect type", cerPV.getAlgorithm(), validValues[i]);
+            assertEquals("Incorrect provider", cerPV.getProvider().getName(),
+                    mProv.getName());
+            checkResult(cerPV);
+        }
+    }
+
+    /**
+     * Test for <code>getInstance(String algorithm, Provider provider)</code>
+     * method 
+     * Assertions: 
+	 * throws NullPointerException when algorithm is null 
+	 * throws NoSuchAlgorithmException when algorithm  is not available
+     * throws IllegalArgumentException when provider is null; 
+     * returns CertPathValidator object
+     */
+    public void testGetInstance03() throws NoSuchAlgorithmException,
+            IllegalArgumentException,
+            InvalidAlgorithmParameterException, CertPathValidatorException {
+        try {
+            CertPathValidator.getInstance(null, mProv);
+            fail("NullPointerException or NoSuchAlgorithmException must be thrown when algorithm is null");
+        } catch (NullPointerException e) {
+        } catch (NoSuchAlgorithmException e) {
+        }
+        for (int i = 0; i < invalidValues.length; i++) {
+            try {
+                CertPathValidator.getInstance(invalidValues[i], mProv);
+                fail("NoSuchAlgorithmException must be thrown (type: ".concat(
+                        invalidValues[i]).concat(")"));
+            } catch (NoSuchAlgorithmException e) {
+            }
+        }
+        Provider prov = null;
+        for (int i = 0; i < validValues.length; i++) {
+            try {
+                CertPathValidator.getInstance(validValues[i], prov);
+                fail("IllegalArgumentException must be thrown when provider is null (type: "
+                        .concat(validValues[i]).concat(")"));
+            } catch (IllegalArgumentException e) {
+            }
+        }
+        CertPathValidator cerPV;
+        for (int i = 0; i < validValues.length; i++) {
+            cerPV = CertPathValidator.getInstance(validValues[i], mProv);
+            assertEquals("Incorrect type", cerPV.getAlgorithm(), validValues[i]);
+            assertEquals("Incorrect provider", cerPV.getProvider(), mProv);
+            checkResult(cerPV);
+        }
+    }
+}



Mime
View raw message