harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r373789 [4/9] - in /incubator/harmony/enhanced/classlib/trunk/modules/security2/test: common/unit/java/security/ common/unit/java/security/cert/ common/unit/java/security/interfaces/ common/unit/java/security/spec/ common/unit/javax/crypto/...
Date Tue, 31 Jan 2006 11:04:50 GMT
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/CertificateFactory3Test.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/CertificateFactory3Test.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/CertificateFactory3Test.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/CertificateFactory3Test.java Tue Jan 31 03:01:12 2006
@@ -33,7 +33,7 @@
 import java.util.Vector;
 
 import org.apache.harmony.security.SpiEngUtils;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
 import org.apache.harmony.security.test.TestUtils;
 
 
@@ -41,7 +41,7 @@
  * Tests for <code>CertificateFactory</code> class methods
  */
 
-public class CertificateFactory3Test extends PerformanceTest {
+public class CertificateFactory3Test extends TestCase {
 
     /**
      * Constructor for CertificateFactoryFileTests.
@@ -58,10 +58,6 @@
 
     private static String defaultType = CertificateFactory1Test.defaultType;
 
-    private final static String[] validValues = CertificateFactory1Test.validValues;
-
-    private final static String[] invalidValues = SpiEngUtils.invalidValues;
-    
     public static String fileCertificateX509 = "java/security/cert/serialization/Certificate.X.509";
     public static String fileCertPathPki = "java/security/cert/serialization/CertPath.PkiPath";
 
@@ -169,7 +165,7 @@
         FileInputStream fis = new FileInputStream(fileCertificateX509);
         Certificate cert = certFs[0].generateCertificate(fis);
         fis.close();
-        List list = (List) new Vector();
+        List list = new Vector();
         list.add(cert);
         for (int i = 0; i < certFs.length; i++) {
             CertPath certPath = null;
@@ -223,7 +219,7 @@
         for (int i = 0; i < certFs.length; i++) {
             Iterator it = certFs[0].getCertPathEncodings();
             if (it.hasNext()) {
-                if (certPathEncoding.equals((String)it.next())) {
+                if (certPathEncoding.equals(it.next())) {
                     CertPath certPath = null;
                     FileInputStream fis = new FileInputStream(fileCertPathPki);
                     certPath = certFs[i].generateCertPath(fis);
@@ -232,11 +228,11 @@
                     List list1 = certPath.getCertificates();
                     assertFalse("Result list is empty",list1.isEmpty());
                 } else {
-                    logln("Default encoding is not ".concat(fileCertPathPki));
+                    fail("Default encoding is not ".concat(certPathEncoding));
                 }
             } else {
                 fail("There are no CertPath encodings");
             }
         }
     }
-}
\ No newline at end of file
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/CertificateFactorySpiTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/CertificateFactorySpiTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/CertificateFactorySpiTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/CertificateFactorySpiTest.java Tue Jan 31 03:01:12 2006
@@ -29,14 +29,14 @@
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
 
 /**
  * Tests for <code>CertificateFactorySpi</code> class constructors and methods
  * 
  */
 
-public class CertificateFactorySpiTest extends PerformanceTest {
+public class CertificateFactorySpiTest extends TestCase {
     /**
      * Constructor for CertStoreSpiTest.
      * 
@@ -284,4 +284,4 @@
             return null;
         }
     }
-}
\ No newline at end of file
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/CertificateNotYetValidExceptionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/CertificateNotYetValidExceptionTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/CertificateNotYetValidExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/CertificateNotYetValidExceptionTest.java Tue Jan 31 03:01:12 2006
@@ -23,14 +23,14 @@
 
 import java.security.cert.CertificateNotYetValidException;
 
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
 
 
 /**
  * Tests for <code>DigestException</code> class constructors and methods.
  * 
  */
-public class CertificateNotYetValidExceptionTest extends PerformanceTest {
+public class CertificateNotYetValidExceptionTest extends TestCase {
 
     public static void main(String[] args) {
     }
@@ -80,7 +80,6 @@
      */
     public void testCertificateNotYetValidException01() {
         CertificateNotYetValidException tE = new CertificateNotYetValidException();
-        assertTrue(errNotExc, tE instanceof CertificateNotYetValidException);
         assertNull("getMessage() must return null.", tE.getMessage());
         assertNull("getCause() must return null", tE.getCause());
         try {
@@ -99,8 +98,6 @@
         CertificateNotYetValidException tE;
         for (int i = 0; i < msgs.length; i++) {
             tE = new CertificateNotYetValidException(msgs[i]);
-            assertTrue(errNotExc.concat(" (msg: ").concat(msgs[i]).concat(")"),
-                    tE instanceof CertificateNotYetValidException);
             assertEquals("getMessage() must return: ".concat(msgs[i]), tE
                     .getMessage(), msgs[i]);
             assertNull("getCause() must return null", tE.getCause());
@@ -121,7 +118,6 @@
         String msg = null;
         CertificateNotYetValidException tE = new CertificateNotYetValidException(
                 msg);
-        assertTrue(errNotExc, tE instanceof CertificateNotYetValidException);
         assertNull("getMessage() must return null.", tE.getMessage());
         assertNull("getCause() must return null", tE.getCause());
         try {
@@ -131,4 +127,4 @@
         }
     }
 
-}
\ No newline at end of file
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/CertificateParsingExceptionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/CertificateParsingExceptionTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/CertificateParsingExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/CertificateParsingExceptionTest.java Tue Jan 31 03:01:12 2006
@@ -23,7 +23,7 @@
 
 import java.security.cert.CertificateParsingException;
 
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
 
 
 /**
@@ -31,7 +31,7 @@
  * methods.
  * 
  */
-public class CertificateParsingExceptionTest extends PerformanceTest {
+public class CertificateParsingExceptionTest extends TestCase {
 
     public static void main(String[] args) {
     }
@@ -79,7 +79,6 @@
      */
     public void testCertificateParsingException01() {
         CertificateParsingException tE = new CertificateParsingException();
-        assertTrue(errNotExc, tE instanceof CertificateParsingException);
         assertNull("getMessage() must return null.", tE.getMessage());
         assertNull("getCause() must return null", tE.getCause());
         try {
@@ -98,8 +97,6 @@
         CertificateParsingException tE;
         for (int i = 0; i < msgs.length; i++) {
             tE = new CertificateParsingException(msgs[i]);
-            assertTrue(errNotExc.concat(" (msg: ").concat(msgs[i]).concat(")"),
-                    tE instanceof CertificateParsingException);
             assertEquals("getMessage() must return: ".concat(msgs[i]), tE
                     .getMessage(), msgs[i]);
             assertNull("getCause() must return null", tE.getCause());
@@ -119,7 +116,6 @@
     public void testCertificateParsingException03() {
         String msg = null;
         CertificateParsingException tE = new CertificateParsingException(msg);
-        assertTrue(errNotExc, tE instanceof CertificateParsingException);
         assertNull("getMessage() must return null.", tE.getMessage());
         assertNull("getCause() must return null", tE.getCause());
         try {
@@ -137,7 +133,6 @@
     public void testCertificateParsingException04() {
         Throwable cause = null;
         CertificateParsingException tE = new CertificateParsingException(cause);
-        assertTrue(errNotExc, tE instanceof CertificateParsingException);
         assertNull("getMessage() must return null.", tE.getMessage());
         assertNull("getCause() must return null", tE.getCause());
         try {
@@ -154,7 +149,6 @@
      */
     public void testCertificateParsingException05() {
         CertificateParsingException tE = new CertificateParsingException(tCause);
-        assertTrue(errNotExc, tE instanceof CertificateParsingException);
         if (tE.getMessage() != null) {
             String toS = tCause.toString();
             String getM = tE.getMessage();
@@ -179,7 +173,6 @@
     public void testCertificateParsingException06() {
         CertificateParsingException tE = new CertificateParsingException(null,
                 null);
-        assertTrue(errNotExc, tE instanceof CertificateParsingException);
         assertNull("getMessage() must return null", tE.getMessage());
         assertNull("getCause() must return null", tE.getCause());
         try {
@@ -198,8 +191,6 @@
         CertificateParsingException tE;
         for (int i = 0; i < msgs.length; i++) {
             tE = new CertificateParsingException(msgs[i], null);
-            assertTrue(errNotExc.concat(" (msg: ").concat(msgs[i]).concat(")"),
-                    tE instanceof CertificateParsingException);
             assertEquals("getMessage() must return: ".concat(msgs[i]), tE
                     .getMessage(), msgs[i]);
             assertNull("getCause() must return null", tE.getCause());
@@ -219,7 +210,6 @@
     public void testCertificateParsingException08() {
         CertificateParsingException tE = new CertificateParsingException(null,
                 tCause);
-        assertTrue(errNotExc, tE instanceof CertificateParsingException);
         if (tE.getMessage() != null) {
             String toS = tCause.toString();
             String getM = tE.getMessage();
@@ -245,8 +235,6 @@
         CertificateParsingException tE;
         for (int i = 0; i < msgs.length; i++) {
             tE = new CertificateParsingException(msgs[i], tCause);
-            assertTrue(errNotExc.concat(" (msg: ").concat(msgs[i]).concat(")"),
-                    tE instanceof CertificateParsingException);
             String getM = tE.getMessage();
             String toS = tCause.toString();
             if (msgs[i].length() > 0) {
@@ -268,4 +256,4 @@
             }
         }
     }
-}
\ No newline at end of file
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/CertificateTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/CertificateTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/CertificateTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/CertificateTest.java Tue Jan 31 03:01:12 2006
@@ -27,14 +27,14 @@
 import java.security.SignatureException;
 
 import org.apache.harmony.security.cert.MyCertificate;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
 
 
 /**
  * Tests for <code>Certificate</code> fields and methods
  * 
  */
-public class CertificateTest extends PerformanceTest {
+public class CertificateTest extends TestCase {
     /**
      * Meaningless cert encoding just for testing purposes
      */
@@ -75,7 +75,7 @@
     public final void testHashCode() {
         Certificate c1 = new MyCertificate("TEST_TYPE", testEncoding);
         Certificate c2 = new MyCertificate("TEST_TYPE", testEncoding);
-        logln(getName() + ": " + c1.hashCode());
+
         assertTrue(c1.hashCode() == c2.hashCode());
     }
 
@@ -86,7 +86,7 @@
     public final void testHashCodeEqualsObject() {
         Certificate c1 = new MyCertificate("TEST_TYPE", testEncoding);
         Certificate c2 = new MyCertificate("TEST_TYPE", testEncoding);
-        logln(getName() + ": " + c1.hashCode());
+
         assertTrue((c1.hashCode() == c2.hashCode()) && c1.equals(c2));
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/CollectionCertStoreParametersTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/CollectionCertStoreParametersTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/CollectionCertStoreParametersTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/CollectionCertStoreParametersTest.java Tue Jan 31 03:01:12 2006
@@ -25,14 +25,14 @@
 import java.util.Vector;
 
 import org.apache.harmony.security.cert.MyCertificate;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
 
 
 /**
  * Tests for <code>CollectionCertStoreParameters</code>
  * 
  */
-public class CollectionCertStoreParametersTest extends PerformanceTest {
+public class CollectionCertStoreParametersTest extends TestCase {
 
     /*
      * @see TestCase#setUp()
@@ -69,7 +69,6 @@
         CertStoreParameters cp = new CollectionCertStoreParameters();
         assertTrue("isCollectionCertStoreParameters",
                 cp instanceof CollectionCertStoreParameters);
-        assertTrue("isCloneable", cp instanceof Cloneable);
     }
 
     /**
@@ -81,16 +80,14 @@
         CollectionCertStoreParameters cp = new CollectionCertStoreParameters();
         Collection c = cp.getCollection();
         assertTrue("isEmpty", c.isEmpty());
+
         // check that empty collection is immutable
-        boolean xHasBeenThrown = false;
         try {
             // try to modify it
             c.add(new Object());
+            fail("empty collection must be immutable");
         } catch (Exception e) {
-            xHasBeenThrown = true;
-            logln(getName() + ": " + e);
         }
-        assertTrue("isImmutable", xHasBeenThrown);
     }
 
     /**
@@ -101,10 +98,7 @@
     public final void testCollectionCertStoreParametersCollection01() {
         Vector certificates = new Vector();
         certificates.add(new MyCertificate("TEST", new byte[] {}));
-        CollectionCertStoreParameters cp =
-            new CollectionCertStoreParameters(certificates);
-        assertTrue("isCertStoreParameters", cp instanceof CertStoreParameters);
-        assertTrue("isCloneable", cp instanceof Cloneable);
+        new CollectionCertStoreParameters(certificates);
     }
 
     /**
@@ -120,8 +114,7 @@
         // a Certificate or CRL
         Vector certificates = new Vector();
         certificates.add(new String("Not a Certificate"));
-        CollectionCertStoreParameters cp =
-            new CollectionCertStoreParameters(certificates);
+        new CollectionCertStoreParameters(certificates);
     }
 
     /**
@@ -156,17 +149,11 @@
      * <code>collection</code> is <code>null</code> 
      */
     public final void testCollectionCertStoreParametersCollection04() {
-        boolean npeHasBeenThrown = false;
         try {
-            CollectionCertStoreParameters cp =
-                new CollectionCertStoreParameters(null);
-        } catch (Exception e) {
-            if (e instanceof NullPointerException) {
-                npeHasBeenThrown = true;
-            }
-            logln(getName() + ": " + e);
+            new CollectionCertStoreParameters(null);
+            fail("NPE expected");
+        } catch (NullPointerException e) {
         }
-        assertTrue(npeHasBeenThrown);
     }
 
     /**
@@ -225,7 +212,6 @@
         CollectionCertStoreParameters cp =
             new CollectionCertStoreParameters();
         String s = cp.toString();
-        logln(getName() + ": " + s);
         assertTrue(s != null);
     }
 
@@ -238,9 +224,8 @@
         certificates.add(new MyCertificate("TEST", new byte[] {(byte)4}));
         CollectionCertStoreParameters cp =
             new CollectionCertStoreParameters(certificates);
-        String s = cp.toString();
-        logln(getName() + ": " + s);
-        assertTrue(s != null);
+
+        assertNotNull(cp.toString());
     }
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/LDAPCertStoreParametersTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/LDAPCertStoreParametersTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/LDAPCertStoreParametersTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/LDAPCertStoreParametersTest.java Tue Jan 31 03:01:12 2006
@@ -21,14 +21,14 @@
 
 package java.security.cert;
 
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
 
 /**
  * Tests for <code>java.security.cert.LDAPCertStoreParameters</code>
  * fields and methods
  * 
  */
-public class LDAPCertStoreParametersTest extends PerformanceTest {
+public class LDAPCertStoreParametersTest extends TestCase {
 
     /*
      * @see TestCase#setUp()
@@ -65,7 +65,6 @@
         CertStoreParameters cp = new LDAPCertStoreParameters();
         assertTrue("isLDAPCertStoreParameters",
                 cp instanceof LDAPCertStoreParameters);
-        assertTrue("isCloneable", cp instanceof Cloneable);
     }
 
     /**
@@ -88,7 +87,6 @@
         CertStoreParameters cp = new LDAPCertStoreParameters("myhost");
         assertTrue("isLDAPCertStoreParameters",
                 cp instanceof LDAPCertStoreParameters);
-        assertTrue("isCloneable", cp instanceof Cloneable);
     }
 
     /**
@@ -109,16 +107,11 @@
      * if <code>serverName</code> is <code>null</code>
      */
     public final void testLDAPCertStoreParametersString03() {
-        boolean npeHasBeenThrown = false;
         try {
-            LDAPCertStoreParameters cp = new LDAPCertStoreParameters(null);
-        } catch (Exception e) {
-            if (e instanceof NullPointerException) {
-                npeHasBeenThrown = true;
-            }
-            logln(getName() + ": " + e);
+            new LDAPCertStoreParameters(null);
+            fail("NPE expected");
+        } catch (NullPointerException e) {
         }
-        assertTrue(npeHasBeenThrown);
     }
 
     /**
@@ -130,7 +123,6 @@
         CertStoreParameters cp = new LDAPCertStoreParameters("myhost", 1098);
         assertTrue("isLDAPCertStoreParameters",
                 cp instanceof LDAPCertStoreParameters);
-        assertTrue("isCloneable", cp instanceof Cloneable);
     }
 
     /**
@@ -153,16 +145,11 @@
      * if <code>serverName</code> is <code>null</code>
      */
     public final void testLDAPCertStoreParametersStringint03() {
-        boolean npeHasBeenThrown = false;
         try {
-            LDAPCertStoreParameters cp = new LDAPCertStoreParameters(null, 0);
-        } catch (Exception e) {
-            if (e instanceof NullPointerException) {
-                npeHasBeenThrown = true;
-            }
-            logln(getName() + ": " + e);
+            new LDAPCertStoreParameters(null, 0);
+            fail("NPE expected");
+        } catch (NullPointerException e) {
         }
-        assertTrue(npeHasBeenThrown);
     }
 
     /**
@@ -187,9 +174,8 @@
     public final void testToString() {
         LDAPCertStoreParameters cp1 =
             new LDAPCertStoreParameters("myhost", 1101);
-        String rep = cp1.toString();
-        logln(getName() + ": " + rep);
-        assertTrue(rep != null);
+
+        assertNotNull(cp1.toString());
     }
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/PKIXBuilderParametersTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/PKIXBuilderParametersTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/PKIXBuilderParametersTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/PKIXBuilderParametersTest.java Tue Jan 31 03:01:12 2006
@@ -29,14 +29,14 @@
 import java.util.Set;
 
 import org.apache.harmony.security.cert.TestUtils;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
 
 
 /**
  * Tests for <code>PKIXBuilderParameters</code> fields and methods
  * 
  */
-public class PKIXBuilderParametersTest extends PerformanceTest {
+public class PKIXBuilderParametersTest extends TestCase {
     private static final int DEFAULT_MAX_PATH_LEN = 5;
     /*
      * @see TestCase#setUp()
@@ -70,8 +70,7 @@
         throws InvalidAlgorithmParameterException {
         Set taSet = TestUtils.getTrustAnchorSet();
         if (taSet == null) {
-            fail(getName() + ": PASSED (could not create test TrustAnchor set)");
-            return;
+            fail(getName() + ": not performed (could not create test TrustAnchor set)");
         }
         // both parameters are valid and non-null
         PKIXParameters p =
@@ -90,8 +89,7 @@
         throws InvalidAlgorithmParameterException {
         Set taSet = TestUtils.getTrustAnchorSet();
         if (taSet == null) {
-            fail(getName() + ": PASSED (could not create test TrustAnchor set)");
-            return;
+            fail(getName() + ": not performed (could not create test TrustAnchor set)");
         }
         // both parameters are valid but CertSelector is null
         PKIXParameters p = new PKIXBuilderParameters(taSet, null);
@@ -110,8 +108,7 @@
         throws InvalidAlgorithmParameterException {
         Set taSet = TestUtils.getTrustAnchorSet();
         if (taSet == null) {
-            fail(getName() + ": PASSED (could not create test TrustAnchor set)");
-            return;
+            fail(getName() + ": not performed (could not create test TrustAnchor set)");
         }
         HashSet originalSet = (HashSet)taSet;
         HashSet originalSetCopy = (HashSet)originalSet.clone();
@@ -132,19 +129,13 @@
      * Assertion: <code>NullPointerException</code> -
      * if the specified <code>Set</code> is null
      */
-    public final void testPKIXBuilderParametersSetCertSelector04() {
-        boolean npeHasBeenThrown = false;
+    public final void testPKIXBuilderParametersSetCertSelector04() throws Exception {
         try {
             // pass null
-            PKIXBuilderParameters pp =
-                new PKIXBuilderParameters((Set)null, null);
-        } catch (Exception e) {
-            if (e instanceof NullPointerException) {
-                npeHasBeenThrown = true;
-            }
-            logln(getName() + ": " + e);
+            new PKIXBuilderParameters((Set)null, null);
+            fail("NPE expected");
+        } catch (NullPointerException e) {
         }
-        assertTrue(npeHasBeenThrown);
     }
 
     /**
@@ -155,18 +146,12 @@
      * (<code>trustAnchors.isEmpty() == true</code>)
      */
     public final void testPKIXBuilderParametersSetCertSelector05() {
-        boolean iapeHasBeenThrown = false;
         try {
             // use empty set
-            PKIXBuilderParameters pp =
-                new PKIXBuilderParameters(new HashSet(), null);
-        } catch (Exception e) {
-            if (e instanceof InvalidAlgorithmParameterException) {
-                iapeHasBeenThrown = true;
-            }
-            logln(getName() + ": " + e);
+            new PKIXBuilderParameters(new HashSet(), null);
+            fail("InvalidAlgorithmParameterException expected");
+        } catch (InvalidAlgorithmParameterException e) {
         }
-        assertTrue(iapeHasBeenThrown);
     }
 
     /**
@@ -176,24 +161,20 @@
      * if any of the elements in the <code>Set</code> are not of type
      * <code>java.security.cert.TrustAnchor</code>
      */
-    public final void testPKIXBuilderParametersSetCertSelector06() {
+    public final void testPKIXBuilderParametersSetCertSelector06() throws Exception {
         Set taSet = TestUtils.getTrustAnchorSet();
         if (taSet == null) {
-            fail(getName() + ": PASSED (could not create test TrustAnchor set)");
-            return;
+            fail(getName() + ": not performed (could not create test TrustAnchor set)");
         }
+
         // add wrong object to valid set
         assertTrue(taSet.add(new Object()));
-        boolean cceHasBeenThrown = false;
+
         try {
-            PKIXBuilderParameters pp = new PKIXBuilderParameters(taSet, null);
-        } catch (Exception e) {
-            if (e instanceof ClassCastException) {
-                cceHasBeenThrown = true;
-            }
-            logln(getName() + ": " + e);
+            new PKIXBuilderParameters(taSet, null);
+            fail("ClassCastException expected");
+        } catch (ClassCastException e) {
         }
-        assertTrue(cceHasBeenThrown);
     }
 
     /**
@@ -208,8 +189,7 @@
                InvalidAlgorithmParameterException {
         KeyStore ks = TestUtils.getKeyStore(true, TestUtils.TRUSTED);
         if (ks == null) {
-            fail(getName() + ": PASSED (could not create test KeyStore)");
-            return;
+            fail(getName() + ": not performed (could not create test KeyStore)");
         }
         // both parameters are valid and non-null
         PKIXParameters p =
@@ -230,8 +210,7 @@
                InvalidAlgorithmParameterException {
         KeyStore ks = TestUtils.getKeyStore(true, TestUtils.TRUSTED);
         if (ks == null) {
-            fail(getName() + ": PASSED (could not create test KeyStore)");
-            return;
+            fail(getName() + ": not performed (could not create test KeyStore)");
         }
         // both parameters are valid but CertSelector is null
         PKIXParameters p =
@@ -254,8 +233,7 @@
                InvalidAlgorithmParameterException {
         KeyStore ks = TestUtils.getKeyStore(true, TestUtils.TRUSTED_AND_UNTRUSTED);
         if (ks == null) {
-            fail(getName() + ": PASSED (could not create test KeyStore)");
-            return;
+            fail(getName() + ": not performed (could not create test KeyStore)");
         }
         // both parameters are valid but CertSelector is null
         PKIXParameters p =
@@ -270,19 +248,13 @@
      * Assertion: <code>NullPointerException</code> -
      * if the <code>keystore</code> is <code>null</code>
      */
-    public final void testPKIXBuilderParametersKeyStoreCertSelector04() {
-        boolean npeHasBeenThrown = false;
+    public final void testPKIXBuilderParametersKeyStoreCertSelector04() throws Exception {
         try {
             // pass null
-            PKIXBuilderParameters pp =
-                new PKIXBuilderParameters((KeyStore)null, null);
-        } catch (Exception e) {
-            if (e instanceof NullPointerException) {
-                npeHasBeenThrown = true;
-            }
-            logln(getName() + ": " + e);
+            new PKIXBuilderParameters((KeyStore)null, null);
+            fail("NPE expected");
+        } catch (NullPointerException e) {
         }
-        assertTrue(npeHasBeenThrown);
     }
 
     /**
@@ -291,23 +263,18 @@
      * Assertion: <code>KeyStoreException</code> -
      * if the <code>keystore</code> has not been initialized
      */
-    public final void testPKIXBuilderParametersKeyStoreCertSelector05() {
+    public final void testPKIXBuilderParametersKeyStoreCertSelector05() throws Exception {
         KeyStore ks = TestUtils.getKeyStore(false, 0);
         if (ks == null) {
-            fail(getName() + ": PASSED (could not create test KeyStore)");
-            return;
+            fail(getName() + ": not performed (could not create test KeyStore)");
         }
-        boolean kseHasBeenThrown = false;
+        
         try {
             // pass not initialized KeyStore
-            PKIXBuilderParameters pp = new PKIXBuilderParameters(ks, null);
-        } catch (Exception e) {
-            if (e instanceof KeyStoreException) {
-                kseHasBeenThrown = true;
-            }
-            logln(getName() + ": " + e);
+            new PKIXBuilderParameters(ks, null);
+            fail("KeyStoreException expected");
+        } catch (KeyStoreException e) {
         }
-        assertTrue(kseHasBeenThrown);
     }
 
     /**
@@ -317,23 +284,19 @@
      * if the <code>keystore</code> does not contain at least one
      * trusted certificate entry
      */
-    public final void testPKIXBuilderParametersKeyStoreCertSelector06() {
+    public final void testPKIXBuilderParametersKeyStoreCertSelector06() throws Exception {
         KeyStore ks = TestUtils.getKeyStore(true, TestUtils.UNTRUSTED);
         if (ks == null) {
-            fail(getName() + ": PASSED (could not create test KeyStore)");
+            fail(getName() + ": not performed (could not create test KeyStore)");
             return;
         }
-        boolean iapeHasBeenThrown = false;
+
         try {
             // pass KeyStore that does not contain trusted certificates
-            PKIXBuilderParameters pp = new PKIXBuilderParameters(ks, null);
-        } catch (Exception e) {
-            if (e instanceof InvalidAlgorithmParameterException) {
-                iapeHasBeenThrown = true;
-            }
-            logln(getName() + ": " + e);
+            new PKIXBuilderParameters(ks, null);
+            fail("InvalidAlgorithmParameterException expected");
+        } catch (InvalidAlgorithmParameterException e) {
         }
-        assertTrue(iapeHasBeenThrown);
     }
 
     /**
@@ -347,8 +310,7 @@
                InvalidAlgorithmParameterException {
         KeyStore ks = TestUtils.getKeyStore(true, TestUtils.TRUSTED);
         if (ks == null) {
-            fail(getName() + ": PASSED (could not create test KeyStore)");
-            return;
+            fail(getName() + ": not performed (could not create test KeyStore)");
         }
         PKIXBuilderParameters p = new PKIXBuilderParameters(ks, null);
         assertEquals(DEFAULT_MAX_PATH_LEN, p.getMaxPathLength());
@@ -366,8 +328,7 @@
                InvalidAlgorithmParameterException {
         KeyStore ks = TestUtils.getKeyStore(true, TestUtils.TRUSTED);
         if (ks == null) {
-            fail(getName() + ": PASSED (could not create test KeyStore)");
-            return;
+            fail(getName() + ": not performed (could not create test KeyStore)");
         }
         // all these VALID maxPathLength values must be
         // set (and get) without exceptions
@@ -391,21 +352,16 @@
                InvalidAlgorithmParameterException {
         KeyStore ks = TestUtils.getKeyStore(true, TestUtils.TRUSTED);
         if (ks == null) {
-            fail(getName() + ": PASSED (could not create test KeyStore)");
-            return;
+            fail(getName() + ": not performed (could not create test KeyStore)");
         }
         PKIXBuilderParameters p = new PKIXBuilderParameters(ks, null);
-        boolean ipeHasBeenThrown = false;
+
         try {
             // pass parameter less than -1
             p.setMaxPathLength(Integer.MIN_VALUE);
-        } catch (Exception e) {
-            if (e instanceof InvalidParameterException) {
-                ipeHasBeenThrown = true;
-            }
-            logln(getName() + ": " + e);
+            fail("InvalidParameterException expected");
+        } catch (InvalidParameterException e) {
         }
-        assertTrue(ipeHasBeenThrown);
     }
 
     /**
@@ -419,13 +375,12 @@
                InvalidAlgorithmParameterException {
         KeyStore ks = TestUtils.getKeyStore(true,TestUtils.TRUSTED_AND_UNTRUSTED);
         if (ks == null) {
-            fail(getName() + ": PASSED (could not create test KeyStore)");
-            return;
+            fail(getName() + ": not performed (could not create test KeyStore)");
         }
         PKIXBuilderParameters p =
             new PKIXBuilderParameters(ks, new X509CertSelector());
         String rep = p.toString();
-        logln(getName() + ": " + rep);
+
         assertNotNull(rep);
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/PKIXCertPathBuilderResultTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/PKIXCertPathBuilderResultTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/PKIXCertPathBuilderResultTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/PKIXCertPathBuilderResultTest.java Tue Jan 31 03:01:12 2006
@@ -27,14 +27,14 @@
 
 import org.apache.harmony.security.cert.MyCertPath;
 import org.apache.harmony.security.cert.TestUtils;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
 
 
 /**
  * Tests for <code>PKIXCertPathBuilderResult</code>
  * 
  */
-public class PKIXCertPathBuilderResultTest extends PerformanceTest {
+public class PKIXCertPathBuilderResultTest extends TestCase {
     /**
      * Cert path encoding stub
      */
@@ -95,8 +95,7 @@
                NoSuchAlgorithmException {
         TrustAnchor ta = TestUtils.getTrustAnchor();
         if (ta == null) {
-            fail(getName() + ": PASSED (could not create test TrustAnchor)");
-            return;
+            fail(getName() + ": not performed (could not create test TrustAnchor)");
         }
         CertPathBuilderResult r =
             new PKIXCertPathBuilderResult(
@@ -119,8 +118,7 @@
                NoSuchAlgorithmException {
         TrustAnchor ta = TestUtils.getTrustAnchor();
         if (ta == null) {
-            fail(getName() + ": PASSED (could not create test TrustAnchor)");
-            return;
+            fail(getName() + ": not performed (could not create test TrustAnchor)");
         }
         CertPathBuilderResult r =
             new PKIXCertPathBuilderResult(
@@ -140,25 +138,19 @@
     public final void testPKIXCertPathBuilderResult03() {
         TrustAnchor ta = TestUtils.getTrustAnchor();
         if (ta == null) {
-            fail(getName() + ": PASSED (could not create test TrustAnchor)");
-            return;
+            fail(getName() + ": not performed (could not create test TrustAnchor)");
         }
-        boolean npeHasBeenThrown = false;
+
         try {
             // pass null
-            CertPathBuilderResult r =
-                new PKIXCertPathBuilderResult(
-                        null,
-                        ta,
-                        TestUtils.getPolicyTree(),
-                        testPublicKey);
-        } catch (Exception e) {
-            if (e instanceof NullPointerException) {
-                npeHasBeenThrown = true;
-            }
-            logln(getName() + ": " + e);
+            new PKIXCertPathBuilderResult(
+                    null,
+                    ta,
+                    TestUtils.getPolicyTree(),
+                    testPublicKey);
+            fail("NPE expected");
+        } catch (NullPointerException e) {
         }
-        assertTrue(npeHasBeenThrown);
     }
 
     /**
@@ -170,15 +162,13 @@
     public final void testPKIXCertPathBuilderResult04() {
         try {
             // pass null
-            CertPathBuilderResult r =
-                new PKIXCertPathBuilderResult(
-                        new MyCertPath(testEncoding),
-                        null,
-                        TestUtils.getPolicyTree(),
-                        testPublicKey);
-            fail(getName() + "NullPointerException has not been thrown");
-        } catch (NullPointerException ok) {
-            logln(getName() + ": " + ok);
+            new PKIXCertPathBuilderResult(
+                    new MyCertPath(testEncoding),
+                    null,
+                    TestUtils.getPolicyTree(),
+                    testPublicKey);
+            fail("NPE expected");
+        } catch (NullPointerException e) {
         }
     }
 
@@ -191,25 +181,19 @@
     public final void testPKIXCertPathBuilderResult05() {
         TrustAnchor ta = TestUtils.getTrustAnchor();
         if (ta == null) {
-            fail(getName() + ": PASSED (could not create test TrustAnchor)");
-            return;
+            fail(getName() + ": not performed (could not create test TrustAnchor)");
         }
-        boolean npeHasBeenThrown = false;
+
         try {
             // pass null
-            CertPathBuilderResult r =
-                new PKIXCertPathBuilderResult(
-                        new MyCertPath(testEncoding),
-                        ta,
-                        TestUtils.getPolicyTree(),
-                        null);
-        } catch (Exception e) {
-            if (e instanceof NullPointerException) {
-                npeHasBeenThrown = true;
-            }
-            logln(getName() + ": " + e);
+            new PKIXCertPathBuilderResult(
+                    new MyCertPath(testEncoding),
+                    ta,
+                    TestUtils.getPolicyTree(),
+                    null);
+            fail("NPE expected");
+        } catch (NullPointerException e) {
         }
-        assertTrue(npeHasBeenThrown);
     }
 
     /**
@@ -219,14 +203,12 @@
      * @throws NoSuchAlgorithmException
      * @throws InvalidKeySpecException
      */
-    public final void testGetCertPath()
-        throws InvalidKeySpecException,
-               NoSuchAlgorithmException {
+    public final void testGetCertPath() throws Exception {
         TrustAnchor ta = TestUtils.getTrustAnchor();
         if (ta == null) {
-            fail(getName() + ": PASSED (could not create test TrustAnchor)");
-            return;
+            fail(getName() + ": not performed (could not create test TrustAnchor)");
         }
+
         CertPath cp = new MyCertPath(testEncoding);
         CertPathBuilderResult r =
             new PKIXCertPathBuilderResult(
@@ -234,6 +216,7 @@
                     ta,
                     TestUtils.getPolicyTree(),
                     testPublicKey);
+
         // must return the same reference
         // as passed to the constructor
         assertSame(cp, r.getCertPath());
@@ -250,8 +233,7 @@
                NoSuchAlgorithmException {
         TrustAnchor ta = TestUtils.getTrustAnchor();
         if (ta == null) {
-            fail(getName() + ": PASSED (could not create test TrustAnchor)");
-            return;
+            fail(getName() + ": not performed (could not create test TrustAnchor)");
         }
         CertPathBuilderResult r =
             new PKIXCertPathBuilderResult(
@@ -259,9 +241,8 @@
                     ta,
                     TestUtils.getPolicyTree(),
                     testPublicKey);
-        String rep = r.toString();
-        logln(getName() + ": " + rep);
-        assertNotNull(rep);
+
+        assertNotNull(r.toString());
     }
 
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/PKIXCertPathCheckerTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/PKIXCertPathCheckerTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/PKIXCertPathCheckerTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/PKIXCertPathCheckerTest.java Tue Jan 31 03:01:12 2006
@@ -25,14 +25,14 @@
 
 import org.apache.harmony.security.cert.MyCertificate;
 import org.apache.harmony.security.cert.TestUtils;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
 
 
 /**
  * Tests for <code>PKIXCertPathChecker</code>
  * 
  */
-public class PKIXCertPathCheckerTest extends PerformanceTest {
+public class PKIXCertPathCheckerTest extends TestCase {
 
     /*
      * @see TestCase#setUp()

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/PKIXCertPathValidatorResultTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/PKIXCertPathValidatorResultTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/PKIXCertPathValidatorResultTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/cert/PKIXCertPathValidatorResultTest.java Tue Jan 31 03:01:12 2006
@@ -26,14 +26,14 @@
 import java.security.spec.InvalidKeySpecException;
 
 import org.apache.harmony.security.cert.TestUtils;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
 
 
 /**
  * Tests for <code>PKIXCertPathValidatorResult</code>
  * 
  */
-public class PKIXCertPathValidatorResultTest extends PerformanceTest {
+public class PKIXCertPathValidatorResultTest extends TestCase {
     /**
      * PublicKey stub
      */
@@ -89,14 +89,12 @@
                NoSuchAlgorithmException {
         TrustAnchor ta = TestUtils.getTrustAnchor();
         if (ta == null) {
-            fail(getName() + ": PASSED (could not create test TrustAnchor)");
-            return;
+            fail(getName() + ": not performed (could not create test TrustAnchor)");
         }
-        PKIXCertPathValidatorResult vr =
-            new PKIXCertPathValidatorResult(
-                    ta,
-                    TestUtils.getPolicyTree(),
-                    testPublicKey);
+        new PKIXCertPathValidatorResult(
+                ta,
+                TestUtils.getPolicyTree(),
+                testPublicKey);
     }
 
     /**
@@ -106,21 +104,15 @@
      * <code>TrustAnchor</code> parameter is <code>null</code>
      */
     public final void testPKIXCertPathValidatorResult02() {
-        boolean npeHasBeenThrown = false;
         try {
             // pass null
-            PKIXCertPathValidatorResult vr =
-                new PKIXCertPathValidatorResult(
-                        null,
-                        TestUtils.getPolicyTree(),
-                        testPublicKey);
-        } catch (Exception e) {
-            if (e instanceof NullPointerException) {
-                npeHasBeenThrown = true;
-            }
-            logln(getName() + ": " + e);
+            new PKIXCertPathValidatorResult(
+                    null,
+                    TestUtils.getPolicyTree(),
+                    testPublicKey);
+            fail("NPE expected");
+        } catch (NullPointerException e) {
         }
-        assertTrue(npeHasBeenThrown);
     }
 
     /**
@@ -132,24 +124,17 @@
     public final void testPKIXCertPathValidatorResult03() {
         TrustAnchor ta = TestUtils.getTrustAnchor();
         if (ta == null) {
-            fail(getName() + ": PASSED (could not create test TrustAnchor)");
-            return;
+            fail(getName() + ": not performed (could not create test TrustAnchor)");
         }
-        boolean npeHasBeenThrown = false;
         try {
             // pass null
-            PKIXCertPathValidatorResult vr =
-                new PKIXCertPathValidatorResult(
-                        ta,
-                        TestUtils.getPolicyTree(),
-                        null);
-        } catch (Exception e) {
-            if (e instanceof NullPointerException) {
-                npeHasBeenThrown = true;
-            }
-            logln(getName() + ": " + e);
+            new PKIXCertPathValidatorResult(
+                    ta,
+                    TestUtils.getPolicyTree(),
+                    null);
+            fail("NPE expected");
+        } catch (NullPointerException e) {
         }
-        assertTrue(npeHasBeenThrown);
     }
 
     /**
@@ -157,19 +142,16 @@
      * PolicyNode, PublicKey)</code> constructor<br>
      * Assertion: <code>PolicyNode</code>can be <code>null</code>
      */
-    public final void testPKIXCertPathValidatorResult04()
-        throws InvalidKeySpecException,
-               NoSuchAlgorithmException {
+    public final void testPKIXCertPathValidatorResult04() throws Exception {
         TrustAnchor ta = TestUtils.getTrustAnchor();
         if (ta == null) {
-            fail(getName() + ": PASSED (could not create test TrustAnchor)");
-            return;
+            fail(getName() + ": not performed (could not create test TrustAnchor)");
         }
-        PKIXCertPathValidatorResult vr =
-            new PKIXCertPathValidatorResult(
-                    ta,
-                    null,
-                    testPublicKey);
+
+        new PKIXCertPathValidatorResult(
+                ta,
+                null,
+                testPublicKey);
     }
 
     /**
@@ -178,19 +160,18 @@
      * @throws NoSuchAlgorithmException
      * @throws InvalidKeySpecException
      */
-    public final void testGetTrustAnchor()
-        throws InvalidKeySpecException,
-               NoSuchAlgorithmException {
+    public final void testGetTrustAnchor() throws Exception {
         TrustAnchor ta = TestUtils.getTrustAnchor();
         if (ta == null) {
-            fail(getName() + ": PASSED (could not create test TrustAnchor)");
-            return;
+            fail(getName() + ": not performed (could not create test TrustAnchor)");
         }
+
         PKIXCertPathValidatorResult vr =
             new PKIXCertPathValidatorResult(
                     ta,
                     null,
                     testPublicKey);
+
         // must return the same reference passed
         // as a parameter to the constructor
         assertSame(ta, vr.getTrustAnchor());
@@ -202,20 +183,19 @@
      * @throws NoSuchAlgorithmException
      * @throws InvalidKeySpecException
      */
-    public final void testGetPublicKey()
-        throws InvalidKeySpecException,
-               NoSuchAlgorithmException {
+    public final void testGetPublicKey() throws Exception {
         TrustAnchor ta = TestUtils.getTrustAnchor();
         if (ta == null) {
-            fail(getName() + ": PASSED (could not create test TrustAnchor)");
-            return;
+            fail(getName() + ": not performed (could not create test TrustAnchor)");
         }
+
         PublicKey pk = testPublicKey;
         PKIXCertPathValidatorResult vr =
             new PKIXCertPathValidatorResult(
                     ta,
                     null,
                     pk);
+
         // must return the same reference passed
         // as a parameter to the constructor
         assertSame(pk, vr.getPublicKey());
@@ -229,14 +209,12 @@
      * @throws NoSuchAlgorithmException
      * @throws InvalidKeySpecException
      */
-    public final void testGetPolicyTree01()
-        throws InvalidKeySpecException,
-               NoSuchAlgorithmException {
+    public final void testGetPolicyTree01() throws Exception {
         TrustAnchor ta = TestUtils.getTrustAnchor();
         if (ta == null) {
-            fail(getName() + ": PASSED (could not create test TrustAnchor)");
-            return;
+            fail(getName() + ": not performed (could not create test TrustAnchor)");
         }
+
         // valid policy tree case;
         PolicyNode pn = TestUtils.getPolicyTree();
         PKIXCertPathValidatorResult vr =
@@ -244,6 +222,7 @@
                     ta,
                     pn,
                     testPublicKey);
+
         // must return the same reference passed
         // as a parameter to the constructor
         assertSame(pn, vr.getPolicyTree());
@@ -257,20 +236,19 @@
      * @throws NoSuchAlgorithmException
      * @throws InvalidKeySpecException
      */
-    public final void testGetPolicyTree02()
-        throws InvalidKeySpecException,
-               NoSuchAlgorithmException {
+    public final void testGetPolicyTree02() throws Exception {
         TrustAnchor ta = TestUtils.getTrustAnchor();
         if (ta == null) {
-            fail(getName() + ": PASSED (could not create test TrustAnchor)");
-            return;
+            fail(getName() + ": not performed (could not create test TrustAnchor)");
         }
+
         // no valid policy tree case (null)
         PKIXCertPathValidatorResult vr =
             new PKIXCertPathValidatorResult(
                     ta,
                     null,
                     testPublicKey);
+
         // must return the same reference passed
         // as a parameter to the constructor
         assertNull(vr.getPolicyTree());
@@ -282,21 +260,21 @@
      * @throws NoSuchAlgorithmException
      * @throws InvalidKeySpecException
      */
-    public final void testClone()
-        throws InvalidKeySpecException,
-               NoSuchAlgorithmException {
+    public final void testClone() throws Exception {
         TrustAnchor ta = TestUtils.getTrustAnchor();
         if (ta == null) {
-            fail(getName() + ": PASSED (could not create test TrustAnchor)");
-            return;
+            fail(getName() + ": not performed (could not create test TrustAnchor)");
         }
+
         PKIXCertPathValidatorResult vr1 =
             new PKIXCertPathValidatorResult(
                     ta,
                     TestUtils.getPolicyTree(),
                     testPublicKey);
+
         PKIXCertPathValidatorResult vr2 =
             (PKIXCertPathValidatorResult) vr1.clone();
+
         // check that method makes shallow copy
         assertNotSame("notSame", vr1, vr2);
         assertSame("trustAncor", vr1.getTrustAnchor(), vr2.getTrustAnchor());
@@ -310,22 +288,19 @@
      * @throws NoSuchAlgorithmException
      * @throws InvalidKeySpecException
      */
-    public final void testToString01()
-        throws InvalidKeySpecException,
-               NoSuchAlgorithmException {
+    public final void testToString01() throws Exception {
         TrustAnchor ta = TestUtils.getTrustAnchor();
         if (ta == null) {
-            fail(getName() + ": PASSED (could not create test TrustAnchor)");
-            return;
+            fail(getName() + ": not performed (could not create test TrustAnchor)");
         }
+
         PKIXCertPathValidatorResult vr =
             new PKIXCertPathValidatorResult(
                     ta,
                     TestUtils.getPolicyTree(),
                     testPublicKey);
-        String rep = vr.toString();
-        logln(getName() + ": " + rep);
-        assertNotNull(rep);
+
+        assertNotNull(vr.toString());
     }
 
     /**
@@ -334,22 +309,19 @@
      * @throws NoSuchAlgorithmException
      * @throws InvalidKeySpecException
      */
-    public final void testToString02()
-        throws InvalidKeySpecException,
-               NoSuchAlgorithmException {
+    public final void testToString02() throws Exception {
         TrustAnchor ta = TestUtils.getTrustAnchor();
         if (ta == null) {
-            fail(getName() + ": PASSED (could not create test TrustAnchor)");
-            return;
+            fail(getName() + ": not performed (could not create test TrustAnchor)");
         }
+
         PKIXCertPathValidatorResult vr =
             new PKIXCertPathValidatorResult(
                     ta,
                     null,
                     testPublicKey);
-        String rep = vr.toString();
-        logln(getName() + ": " + rep);
-        assertNotNull(rep);
+
+        assertNotNull(vr.toString());
     }
 
 }



Mime
View raw message