harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r373789 [7/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/spec/RSAPrivateKeySpecTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/RSAPrivateKeySpecTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/RSAPrivateKeySpecTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/RSAPrivateKeySpecTest.java Tue Jan 31 03:01:12 2006
@@ -23,14 +23,14 @@
 
 import java.math.BigInteger;
 
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
 
 
 /**
  * Tests for <code>RSAPrivateKeySpec</code> class fields and methods
  * 
  */
-public class RSAPrivateKeySpecTest extends PerformanceTest {
+public class RSAPrivateKeySpecTest extends TestCase {
 
     /*
      * @see TestCase#setUp()

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

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

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/CipherSpiTests.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/CipherSpiTests.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/CipherSpiTests.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/CipherSpiTests.java Tue Jan 31 03:01:12 2006
@@ -30,7 +30,7 @@
 import java.security.AlgorithmParameters;
 import java.nio.ByteBuffer;
 
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
 
 
 /**
@@ -38,7 +38,7 @@
  * 
  */
 
-public class CipherSpiTests extends PerformanceTest {
+public class CipherSpiTests extends TestCase {
 
     /**
      * Constructor for CipherSpiTests.
@@ -350,4 +350,4 @@
     BadPaddingException {
         return super.engineDoFinal(input, output);
     }
-}
\ No newline at end of file
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/EncryptedPrivateKeyInfoTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/EncryptedPrivateKeyInfoTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/EncryptedPrivateKeyInfoTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/EncryptedPrivateKeyInfoTest.java Tue Jan 31 03:01:12 2006
@@ -29,7 +29,6 @@
 import java.security.KeyPair;
 import java.security.KeyPairGenerator;
 import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
 import java.security.Provider;
 import java.security.Security;
 import java.security.spec.InvalidKeySpecException;
@@ -41,7 +40,7 @@
 import javax.crypto.spec.PBEKeySpec;
 import javax.crypto.spec.PBEParameterSpec;
 
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
 
 
 /**
@@ -52,7 +51,7 @@
  * security providers list extended by Bouncy Castle's one
  * (http://www.bouncycastle.org)
  */
-public class EncryptedPrivateKeyInfoTest extends PerformanceTest {
+public class EncryptedPrivateKeyInfoTest extends TestCase {
 
     /**
      * "valid" encoding for DSA with alg params
@@ -1195,7 +1194,7 @@
             {"1.2.840.113549.1.3.1",    "DiffieHellman"},
             {"1.2.840.113549.1.5.3",    "pbeWithMD5AndDES-CBC"},
             {"1.2.840.113549.1.12.1.3", "pbeWithSHAAnd3-KeyTripleDES-CBC"},
-            {"1.2.840.113549.1.12.1.6", "pbeWithSHAAnd40BitRC2-CBC"},
+//            {"1.2.840.113549.1.12.1.6", "pbeWithSHAAnd40BitRC2-CBC"},
             {"1.2.840.113549.3.2",      "RC2-CBC"},
             {"1.2.840.113549.3.3",      "RC2-EBC"},
             {"1.2.840.113549.3.4",      "RC4"},
@@ -1362,19 +1361,9 @@
      * @throws IOException
      * @throws NoSuchAlgorithmException
      */
-    public final void testEncryptedPrivateKeyInfobyteArray1()
-            throws NoSuchAlgorithmException, IOException {
-        EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
-                getValidEncryptedPrivateKeyInfoEncoding("DH"));
-        logln(getName() + ": ok");
-//        for (int i = 0; i < algName0.length; i++) {
-//            try {
-//                EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
-//                        getValidEncryptedPrivateKeyInfoEncoding(algName0[i][0]));
-//            } catch (NoSuchAlgorithmException allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
-//            }
-//        }
+    public final void testEncryptedPrivateKeyInfobyteArray1() throws Exception {
+        new EncryptedPrivateKeyInfo(getValidEncryptedPrivateKeyInfoEncoding("DH"));
+
     }
 
     /**
@@ -1390,10 +1379,9 @@
     public final void testEncryptedPrivateKeyInfobyteArray2()
             throws IOException {
         try {
-            EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(null);
+            new EncryptedPrivateKeyInfo(null);
             fail(getName() + ": NullPointerException has not been thrown");
         } catch (NullPointerException ok) {
-            logln(getName() + ": " + ok);
         }
     }
 
@@ -1406,11 +1394,9 @@
      */
     public final void testEncryptedPrivateKeyInfobyteArray3() {
         try {
-            EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
-                    new byte[0]);
+            new EncryptedPrivateKeyInfo(new byte[0]);
             fail(getName() + ": IOException has not been thrown");
         } catch (IOException ok) {
-            logln(getName() + ": " + ok);
         }
     }
 
@@ -1423,11 +1409,10 @@
      */
     public final void testEncryptedPrivateKeyInfobyteArray4() {
         try {
-            EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
+            new EncryptedPrivateKeyInfo(
                     new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });
             fail(getName() + ": IOException has not been thrown");
         } catch (IOException ok) {
-            logln(getName() + ": " + ok);
         }
     }
 
@@ -1438,19 +1423,18 @@
      * Test preconditions: wrong encoding passed as a parameter <br>
      * Expected: <code>IOException</code>
      */
-    public final void testEncryptedPrivateKeyInfobyteArray5() {
+    public final void testEncryptedPrivateKeyInfobyteArray5() throws Exception {
         byte[] enc = null;
         try {
             // 1: get valid encoding
             enc = getValidEncryptedPrivateKeyInfoEncoding("DSA");
+
             // ... and corrupt it (set wrong alg OID length)
             enc[9] = (byte) 6;
-            EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(enc);
+
+            new EncryptedPrivateKeyInfo(enc);
             fail(getName() + "(1): IOException has not been thrown");
         } catch (IOException ok) {
-            logln(getName() + ": " + ok);
-        } catch (NoSuchAlgorithmException allowedFailure) {
-            // loglnError(getName() + ": " + allowedFailure);
         }
 
         try {
@@ -1458,12 +1442,9 @@
             enc = getValidEncryptedPrivateKeyInfoEncoding("DSA");
             // ... and corrupt it (set wrong encrypted data tag)
             enc[307] = (byte) 6;
-            EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(enc);
+            new EncryptedPrivateKeyInfo(enc);
             fail(getName() + "(2): IOException has not been thrown");
         } catch (IOException ok) {
-            logln(getName() + ": " + ok);
-        } catch (NoSuchAlgorithmException allowedFailure) {
-            // loglnError(getName() + ": " + allowedFailure);
         }
 
         try {
@@ -1471,12 +1452,9 @@
             enc = getValidEncryptedPrivateKeyInfoEncoding("DSA");
             // ... and corrupt it (set wrong encrypted data length)
             enc[310] = (byte) 1;
-            EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(enc);
+            new EncryptedPrivateKeyInfo(enc);
             fail(getName() + "(3): IOException has not been thrown");
         } catch (IOException ok) {
-            logln(getName() + ": " + ok);
-        } catch (NoSuchAlgorithmException allowedFailure) {
-            // loglnError(getName() + ": " + allowedFailure);
         }
 
         try {
@@ -1492,15 +1470,11 @@
                 // initialization BUT No AlgorithmParameters instance
                 // available for algName0[i][0].
                 // So just skip this sub test
-                // loglnError(getName() + "(4): SKIPPED LEGITIMATELY");
             } else {
                 fail(getName() + "(4): IOException has not been thrown");
             }
 
         } catch (IOException ok) {
-            logln(getName() + ": " + ok);
-        } catch (NoSuchAlgorithmException allowedFailure) {
-            // loglnError(getName() + ": " + allowedFailure);
         }
 
         try {
@@ -1508,12 +1482,9 @@
             enc = getValidEncryptedPrivateKeyInfoEncoding("DSA");
             // ... and corrupt it (set wrong length for alg params sequence)
             enc[20] = (byte) 0x1d;
-            EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(enc);
+            new EncryptedPrivateKeyInfo(enc);
             fail(getName() + "(5): IOException has not been thrown");
         } catch (IOException ok) {
-            logln(getName() + ": " + ok);
-        } catch (NoSuchAlgorithmException allowedFailure) {
-            // loglnError(getName() + ": " + allowedFailure);
         }
 
         try {
@@ -1521,12 +1492,9 @@
             enc = getValidEncryptedPrivateKeyInfoEncoding("DSA");
             // ... and corrupt it (set wrong length for alg params sequence)
             enc[20] = (byte) 0x1f;
-            EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(enc);
+            new EncryptedPrivateKeyInfo(enc);
             fail(getName() + "(6): IOException has not been thrown");
         } catch (IOException ok) {
-            logln(getName() + ": " + ok);
-        } catch (NoSuchAlgorithmException allowedFailure) {
-            // loglnError(getName() + ": " + allowedFailure);
         }
     }
 
@@ -1540,21 +1508,16 @@
      * 
      * @throws IOException
      */
-    public final void testEncryptedPrivateKeyInfobyteArray6()
-            throws IOException {
-        try {
-            byte[] encoded = getValidEncryptedPrivateKeyInfoEncoding("DSA");
-            byte[] encodedCopy = (byte[]) encoded.clone();
-            // pass valid array
-            EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
-                    encodedCopy);
-            // modify array passed
-            encodedCopy[9] = (byte) 6;
-            // check that internal state has not been affected
-            assertTrue(Arrays.equals(encoded, epki.getEncoded()));
-        } catch (NoSuchAlgorithmException allowedFailure) {
-            // loglnError(getName() + ": " + allowedFailure);
-        }
+    public final void testEncryptedPrivateKeyInfobyteArray6() throws Exception {
+        byte[] encoded = getValidEncryptedPrivateKeyInfoEncoding("DSA");
+        byte[] encodedCopy = (byte[]) encoded.clone();
+        // pass valid array
+        EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
+                encodedCopy);
+        // modify array passed
+        encodedCopy[9] = (byte) 6;
+        // check that internal state has not been affected
+        assertTrue(Arrays.equals(encoded, epki.getEncoded()));
     }
 
     /**
@@ -1566,15 +1529,16 @@
      */
     public final void testEncryptedPrivateKeyInfoStringbyteArray1() {
         boolean performed = false;
+
         for (int i = 0; i < algName0.length; i++) {
             try {
-                EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
+                new EncryptedPrivateKeyInfo(
                         algName0[i][0], encryptedData);
                 performed = true;
-            } catch (NoSuchAlgorithmException allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
+            } catch (NoSuchAlgorithmException allowed) {
             }
         }
+
         assertTrue("Test not perfrormed", performed);
     }
 
@@ -1588,18 +1552,15 @@
      */
     public final void testEncryptedPrivateKeyInfoStringbyteArray2() {
         try {
-            EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
-                    "bla-bla", encryptedData);
+            new EncryptedPrivateKeyInfo("bla-bla", encryptedData);
             fail(getName() + ": NoSuchAlgorithmException has not been thrown");
         } catch (NoSuchAlgorithmException ok) {
-            logln(getName() + ": " + ok);
         }
+
         try {
-            EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo("",
-                    encryptedData);
+            new EncryptedPrivateKeyInfo("", encryptedData);
             fail(getName() + ": NoSuchAlgorithmException has not been thrown");
         } catch (NoSuchAlgorithmException ok) {
-            logln(getName() + ": " + ok);
         }
     }
 
@@ -1618,22 +1579,17 @@
             throws NoSuchAlgorithmException {
         // pass null as name
         try {
-            EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
-                    (String) null, encryptedData);
+            new EncryptedPrivateKeyInfo((String) null, encryptedData);
             fail(getName() + ": NullPointerException has not been thrown");
         } catch (NullPointerException ok) {
-            logln(getName() + ": " + ok);
         }
 
         // pass null as encrypted data
         try {
-            EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo("DSA",
-                    null);
+            new EncryptedPrivateKeyInfo("DSA", null);
             fail(getName() + ": NullPointerException has not been thrown");
         } catch (NullPointerException ok) {
-            logln(getName() + ": " + ok);
         } catch (NoSuchAlgorithmException allowedFailure) {
-            // was: loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             fail(getName() + ": " + allowedFailure);
         }
     }
@@ -1648,13 +1604,11 @@
      */
     public final void testEncryptedPrivateKeyInfoStringbyteArray4() {
         try {
-            EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo("DSA",
+            new EncryptedPrivateKeyInfo("DSA",
                     new byte[] {});
             fail(getName() + ": IllegalArgumentException has not been thrown");
         } catch (IllegalArgumentException ok) {
-            logln(getName() + ": " + ok);
         } catch (NoSuchAlgorithmException allowedFailure) {
-            // was: loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             fail(getName() + " " + allowedFailure);
         }
     }
@@ -1680,7 +1634,6 @@
             // check that internal state has not been affected
             assertTrue(Arrays.equals(encryptedData, epki.getEncryptedData()));
         } catch (NoSuchAlgorithmException allowedFailure) {
-            // was: loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             fail(getName() + " " + allowedFailure);
         }
     }
@@ -1707,12 +1660,10 @@
                 // use pregenerated AlgorithmParameters encodings
                 ap.init(getParametersEncoding(algName0[i][0]));
 
-                EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(ap,
-                        encryptedData);
+                new EncryptedPrivateKeyInfo(ap, encryptedData);
 
                 performed = true;
             } catch (NoSuchAlgorithmException allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             }
         }
         assertTrue("Test not perfrormed", performed);
@@ -1736,23 +1687,20 @@
             throws NoSuchAlgorithmException, IOException {
         // 1: pass null as AlgorithmParameters
         try {
-            EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
-                    (AlgorithmParameters) null, encryptedData);
+            new EncryptedPrivateKeyInfo((AlgorithmParameters) null, encryptedData);
             fail(getName() + ": NullPointerException has not been thrown");
         } catch (NullPointerException ok) {
-            logln(getName() + ": " + ok);
         }
+
         // 2: pass null as encrypted data
         try {
             AlgorithmParameters ap = AlgorithmParameters.getInstance("DSA");
             // use pregenerated AlgorithmParameters encodings
             ap.init(getParametersEncoding("DSA"));
-            EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(ap, null);
+            new EncryptedPrivateKeyInfo(ap, null);
             fail(getName() + ": NullPointerException has not been thrown");
         } catch (NullPointerException ok) {
-            logln(getName() + ": " + ok);
         } catch (NoSuchAlgorithmException allowedFailure) {
-            // was: loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             fail(getName() + " " + allowedFailure);
         }
     }
@@ -1777,14 +1725,11 @@
             // use pregenerated AlgorithmParameters encodings
             ap.init(getParametersEncoding("DSA"));
 
-            EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(ap,
-                    new byte[] {});
+            new EncryptedPrivateKeyInfo(ap, new byte[] {});
             fail(getName() + ": IllegalArgumentException has not been thrown");
 
         } catch (IllegalArgumentException ok) {
-            logln(getName() + ": " + ok);
         } catch (NoSuchAlgorithmException allowedFailure) {
-            // was: loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             fail(getName() + " " + allowedFailure);
         }
     }
@@ -1820,7 +1765,6 @@
             assertTrue(Arrays.equals(encryptedData, epki.getEncryptedData()));
 
         } catch (NoSuchAlgorithmException allowedFailure) {
-            // was: loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             fail(getName() + " " + allowedFailure);
         }
     }
@@ -1841,23 +1785,13 @@
                 EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
                         getValidEncryptedPrivateKeyInfoEncoding(algName0[i][0]));
 
-                logln(getName() + ": " + algName0[i][0] +
-                        ", expected: " + algName0[i][1] +
-                        ", got: " + epki.getAlgName());
-//                if (epki.getAlgParameters() == null) {
-//                    // no AlgorithmParameters instance
-//                    // available for algName0[i][0] so
-//                    // perform another test:
-//                    // epki.getAlgName() must return OID
-//                    // from encoding
-//                    assertTrue("isOID", epki.getAlgName().indexOf('.') != -1);
-//                } else {
-//                    assertEquals("StdName", algName0[i][1], epki.getAlgName());
-//                }
+//                logln(getName() + ": " + algName0[i][0] +
+//                        ", expected: " + algName0[i][1] +
+//                        ", got: " + epki.getAlgName());
+                assertEquals(algName0[i][1], epki.getAlgName());
 
                 performed = true;
-            } catch (NoSuchAlgorithmException allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
+            } catch (NoSuchAlgorithmException allowed) {
             }
         }
         assertTrue("Test not perfrormed", performed);
@@ -1879,14 +1813,13 @@
                 EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
                         algName0[i][0], encryptedData);
 
-                logln(getName() + ": " + algName0[i][0] +
-                        ", expected: " + algName0[i][1] +
-                        ", got: " + epki.getAlgName());
-//                assertEquals(algName0[i][1], epki.getAlgName());
+//                logln(getName() + ": " + algName0[i][0] +
+//                        ", expected: " + algName0[i][1] +
+//                        ", got: " + epki.getAlgName());
+                assertEquals(algName0[i][1], epki.getAlgName());
 
                 performed = true;
             } catch (NoSuchAlgorithmException allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             }
         }
         assertTrue("Test not perfrormed", performed);
@@ -1913,14 +1846,13 @@
                 EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(ap,
                         encryptedData);
 
-                logln(getName() + ": " + algName0[i][0] +
-                        ", expected: " + algName0[i][1] +
-                        ", got: " + epki.getAlgName());
-//                assertEquals(algName0[i][1], epki.getAlgName());
+//                logln(getName() + ": " + algName0[i][0] +
+//                        ", expected: " + algName0[i][1] +
+//                        ", got: " + epki.getAlgName());
+                assertEquals(algName0[i][1], epki.getAlgName());
 
                 performed = true;
             } catch (NoSuchAlgorithmException allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             }
         }
         assertTrue("Test not perfrormed", performed);
@@ -1945,19 +1877,15 @@
 
                 AlgorithmParameters apar = epki.getAlgParameters();
                 if (apar == null) {
-//                    loglnError(getName() + " NOT PERFORMED: " + 
-//                            "No AlgorithmParameters for algorithm " +
-//                            algName0[i][0] + " available");
                     continue;
                 }
+
                 // check that method under test returns
                 // parameters with the same encoded form
                 assertTrue(Arrays.equals(getParametersEncoding(algName0[i][0]),
                         apar.getEncoded()));
                 performed = true;
-                logln(getName() + ": passed for " + algName0[i][0]);
             } catch (NoSuchAlgorithmException allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             }
         }
         assertTrue("Test not perfrormed", performed);
@@ -1975,7 +1903,6 @@
             assertNull(epki.getAlgParameters());
             
         } catch (NoSuchAlgorithmException allowedFailure) {
-                // was: loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
                 fail(getName() + " " + allowedFailure);
         }
     }
@@ -2003,7 +1930,6 @@
 
                 performed = true;
             } catch (NoSuchAlgorithmException allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             }
         }
         assertTrue("Test not perfrormed", performed);
@@ -2035,7 +1961,6 @@
 
                 performed = true;
             } catch (NoSuchAlgorithmException allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             }
         }
         assertTrue("Test not perfrormed", performed);
@@ -2069,7 +1994,6 @@
 
                 performed = true;
             } catch (NoSuchAlgorithmException allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             }
         }
         assertTrue("Test not perfrormed", performed);
@@ -2099,7 +2023,6 @@
 
                 performed = true;
             } catch (NoSuchAlgorithmException allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             }
         }
         assertTrue("Test not perfrormed", performed);
@@ -2126,7 +2049,6 @@
 
                 performed = true;
             } catch (NoSuchAlgorithmException allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             }
         }
         assertTrue("Test not perfrormed", performed);
@@ -2160,7 +2082,6 @@
 
                 performed = true;
             } catch (NoSuchAlgorithmException allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             }
         }
         assertTrue("Test not perfrormed", performed);
@@ -2191,7 +2112,6 @@
 
                 performed = true;
             } catch (NoSuchAlgorithmException allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             }
         }
         assertTrue("Test not perfrormed", performed);
@@ -2219,7 +2139,6 @@
 
                 performed = true;
             } catch (NoSuchAlgorithmException allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             }
         }
         assertTrue("Test not perfrormed", performed);
@@ -2252,7 +2171,6 @@
 
                 performed = true;
             } catch (NoSuchAlgorithmException allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             }
         }
         assertTrue("Test not perfrormed", performed);
@@ -2287,7 +2205,6 @@
 
                 performed = true;
             } catch (NoSuchAlgorithmException allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             }
         }
         assertTrue("Test not perfrormed", performed);
@@ -2321,7 +2238,6 @@
 
                 performed = true;
             } catch (NoSuchAlgorithmException allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             }
         }
         assertTrue("Test not perfrormed", performed);
@@ -2341,14 +2257,12 @@
                     fail(getName() + "NullPointerException has not been thrown");
 
                 } catch (NullPointerException ok) {
-                    logln(getName() + ": " + ok);
                 } catch (InvalidKeySpecException e) {
                     fail(getName() + "Unexpected exception: " + e);
                 }
 
                 performed = true;
             } catch (NoSuchAlgorithmException allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             }
         }
         assertTrue("Test not perfrormed", performed);
@@ -2358,10 +2272,8 @@
      * Encrypted data contains valid PKCS8 key info encoding
      */
     public final void test_ROUNDTRIP_GetKeySpecCipher01() {
-        boolean failed = false;
-        String failedForAlgs = "Failed for:\n";
-        String passedForAlgs = "\nPassed for:\n";
         boolean performed = false;
+
         for (int i = 0; i < algName.length; i++) {
             try {
                 // generate test data
@@ -2376,42 +2288,31 @@
                 } else {
                     epki = new EncryptedPrivateKeyInfo(g.ap(), g.ct());
                 }
+
                 // call methods under test
                 try {
 
                     PKCS8EncodedKeySpec eks = epki.getKeySpec(g.c());
 
-                    if (Arrays.equals(privateKeyInfo, eks.getEncoded())) {
-                        passedForAlgs += algName[i][0] + ", " + algName[i][1] + "\n";
-                    } else {
-                        failed = true;
-                        failedForAlgs += algName[i][0] + ", " + algName[i][1] +
-                        ": comparison\n";
+                    if (!Arrays.equals(privateKeyInfo, eks.getEncoded())) {
+                        fail(algName[i][0] + " != " + algName[i][1]);
                     }
                 } catch (InvalidKeySpecException e) {
-                    failed = true;
-                    failedForAlgs += algName[i][0] + ", " + algName[i][1] +
-                    ": " + e + "\n";
+                    fail(algName[i][0] + ", " + algName[i][1] + e + "\n");
                 }
                 performed = true;
+
             } catch (TestDataGenerator.AllowedFailure allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
-            } catch (NoSuchAlgorithmException allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
+            } catch (NoSuchAlgorithmException allowed) {
             }
         }
-        assertFalse(failedForAlgs+passedForAlgs, failed);
         assertTrue("Test not perfrormed", performed);
-        logln(getName() + passedForAlgs);
     }
 
     /**
      * Encrypted data contains invalid PKCS8 key info encoding
      */
     public final void test_ROUNDTRIP_GetKeySpecCipher02() {
-        boolean failed = false;
-        String failedForAlgs = "Failed for:\n";
-        String passedForAlgs = "\nPassed for:\n";
         boolean performed = false;
         for (int i = 0; i < algName.length; i++) {
             try {
@@ -2427,28 +2328,23 @@
                 } else {
                     epki = new EncryptedPrivateKeyInfo(g.ap(), g.ct());
                 }
+
                 // call methods under test
                 try {
+                    epki.getKeySpec(g.c());
 
-                    PKCS8EncodedKeySpec eks = epki.getKeySpec(g.c());
                     // must not get here because decrypted data does
                     // not represent valid PKCS8 encoding
-                    failed = true;
-                    failedForAlgs += algName[i][0] + ", " + algName[i][1] + "\n";
+                    fail(algName[i][0] + ", " + algName[i][1]);
                 } catch (InvalidKeySpecException ok) {
-                    passedForAlgs += algName[i][0] + ", " + algName[i][1] + "\n";
                 }
 
                 performed = true;
             } catch (TestDataGenerator.AllowedFailure allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             } catch (NoSuchAlgorithmException allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             }
         }
-        assertFalse(failedForAlgs+passedForAlgs, failed);
         assertTrue("Test not perfrormed", performed);
-        logln(getName() + passedForAlgs);
     }
 
     public final void testGetKeySpecKey01() {
@@ -2465,14 +2361,12 @@
                     fail(getName() + "NullPointerException has not been thrown");
 
                 } catch (NullPointerException ok) {
-                    logln(getName() + ": " + ok);
                 } catch (InvalidKeyException e) {
                     fail(getName() + "Unexpected exception: " + e);
                 }
 
                 performed = true;
             } catch (NoSuchAlgorithmException allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             }
         }
         assertTrue("Test not perfrormed", performed);
@@ -2482,9 +2376,6 @@
      * Encrypted data contains valid PKCS8 key info encoding
      */
     public final void test_ROUNDTRIP_GetKeySpecKey01() {
-        boolean failed = false;
-        String failedForAlgs = "Failed for:\n";
-        String passedForAlgs = "\nPassed for:\n";
         boolean performed = false;
         for (int i = 0; i < algName.length; i++) {
             try {
@@ -2505,38 +2396,25 @@
                     PKCS8EncodedKeySpec eks =
                         epki.getKeySpec(g.pubK()==null ? g.k() : g.pubK());
                     
-                    if (Arrays.equals(privateKeyInfo, eks.getEncoded())) {
-                        passedForAlgs += algName[i][0] + ", " + algName[i][1] + "\n";
-                    } else {
-                        failed = true;
-                        failedForAlgs += algName[i][0] + ", " + algName[i][1] +
-                        ": comparison\n";
+                    if (!Arrays.equals(privateKeyInfo, eks.getEncoded())) {
+                        fail(algName[i][0] + " != " + algName[i][1]);
                     }
                 } catch (InvalidKeyException e) {
-                    failed = true;
-                    failedForAlgs += algName[i][0] + ", " + algName[i][1] +
-                    ": " + e + "\n";
+                    fail(algName[i][0] + ", " + algName[i][1] +  ": " + e);
                 }
 
                 performed = true;
             } catch (TestDataGenerator.AllowedFailure allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             } catch (NoSuchAlgorithmException allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             }
         }
-        assertFalse(failedForAlgs+passedForAlgs, failed);
         assertTrue("Test not perfrormed", performed);
-        logln(getName() + passedForAlgs);
     }
 
     /**
      * Encrypted data contains invalid PKCS8 key info encoding
      */
     public final void test_ROUNDTRIP_GetKeySpecKey02() {
-        boolean failed = false;
-        String failedForAlgs = "Failed for:\n";
-        String passedForAlgs = "\nPassed for:\n";
         boolean performed = false;
         for (int i = 0; i < algName.length; i++) {
             try {
@@ -2554,29 +2432,20 @@
                 }
                 
                 try {
-                    PKCS8EncodedKeySpec eks =
-                        epki.getKeySpec(g.pubK()==null ? g.k() : g.pubK());
-                    
-                    failed = true;
-                    failedForAlgs += algName[i][0] + ", " + algName[i][1] + "\n";
-
+                    epki.getKeySpec(g.pubK()==null ? g.k() : g.pubK());
+                    fail(algName[i][0] + ", " + algName[i][1]);
                 } catch (InvalidKeyException e) {
-                    passedForAlgs += algName[i][0] + ", " + algName[i][1] + "\n";
                 }
 
                 performed = true;
             } catch (TestDataGenerator.AllowedFailure allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             } catch (NoSuchAlgorithmException allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             }
         }
-        assertFalse(failedForAlgs+passedForAlgs, failed);
         assertTrue("Test not perfrormed", performed);
-        logln(getName() + passedForAlgs);
     }
 
-    public final void testGetKeySpecKeyString01() {
+    public final void testGetKeySpecKeyString01() throws Exception {
         boolean performed = false;
         for (int i = 0; i < algName0.length; i++) {
             try {
@@ -2590,11 +2459,6 @@
                     fail(getName() + "NullPointerException has not been thrown");
 
                 } catch (NullPointerException ok) {
-                    logln(getName() + ": " + ok);
-                } catch (InvalidKeyException e) {
-                    fail(getName() + "Unexpected exception: " + e);
-                } catch (NoSuchProviderException e) {
-                    fail(getName() + "Unexpected exception: " + e);
                 }
 
                 try {
@@ -2617,16 +2481,10 @@
                     fail(getName() + "NullPointerException has not been thrown");
 
                 } catch (NullPointerException ok) {
-                    logln(getName() + ": " + ok);
-                } catch (InvalidKeyException e) {
-                    fail(getName() + "Unexpected exception: " + e);
-                } catch (NoSuchProviderException e) {
-                    fail(getName() + "Unexpected exception: " + e);
                 }
 
                 performed = true;
             } catch (NoSuchAlgorithmException allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             }
         }
         assertTrue("Test not perfrormed", performed);
@@ -2635,10 +2493,7 @@
     /**
      * Encrypted data contains valid PKCS8 key info encoding
      */
-    public final void test_ROUNDTRIP_GetKeySpecKeyString01() {
-        boolean failed = false;
-        String failedForAlgs = "Failed for:\n";
-        String passedForAlgs = "\nPassed for:\n";
+    public final void test_ROUNDTRIP_GetKeySpecKeyString01() throws Exception {
         boolean performed = false;
         for (int i = 0; i < algName.length; i++) {                
             for (int l=0; l<provider.length; l++) {
@@ -2651,9 +2506,9 @@
                     g = new TestDataGenerator(algName[i][0], algName[i][1],
                             privateKeyInfo, provider[l]);
                 } catch (TestDataGenerator.AllowedFailure allowedFailure) {
-//                    loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
                     continue;
-                }                    
+                }
+                    
                 try {
                     // create test object
                     EncryptedPrivateKeyInfo epki;
@@ -2668,40 +2523,25 @@
                             epki.getKeySpec(g.pubK()==null ? g.k() : g.pubK(),
                                     provider[l].getName());
 
-                        if (Arrays.equals(privateKeyInfo, eks.getEncoded())) {
-                            passedForAlgs += algName[i][0] + ", " + algName[i][1] + "\n";
-                        } else {
-                            failed = true;
-                            failedForAlgs += algName[i][0] + ", " + algName[i][1] +
-                            ": comparison\n";
+                        if (!Arrays.equals(privateKeyInfo, eks.getEncoded())) {
+                            fail(algName[i][0] + " != " + algName[i][1]);
                         }
                     } catch (InvalidKeyException e) {
-                        failed = true;
-                        failedForAlgs += algName[i][0] + ", " + algName[i][1] +
-                        ": " + e + "\n";
+                        fail(algName[i][0] + ", " + algName[i][1] + ": " + e);
                     }
                     
                     performed = true;
-                } catch (NoSuchProviderException e) {
-                    fail(getName() + ": " + e);
                 } catch (NoSuchAlgorithmException allowedFailure) {
-                    // loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure
-                    //        + ", provider=" + provider[l]);
                 }
             }
         }
-        assertFalse(failedForAlgs+passedForAlgs, failed);
         assertTrue("Test not perfrormed", performed);
-        logln(getName() + passedForAlgs);
     }
 
     /**
      * Encrypted data contains invalid PKCS8 key info encoding
      */
-    public final void test_ROUNDTRIP_GetKeySpecKeyString02() {
-        boolean failed = false;
-        String failedForAlgs = "Failed for:\n";
-        String passedForAlgs = "\nPassed for:\n";
+    public final void test_ROUNDTRIP_GetKeySpecKeyString02() throws Exception {
         boolean performed = false;
         for (int i = 0; i < algName.length; i++) {                
             for (int l=0; l<provider.length; l++) {
@@ -2714,9 +2554,9 @@
                     g = new TestDataGenerator(algName[i][0], algName[i][1],
                             privateKeyInfoDamaged, provider[l]);
                 } catch (TestDataGenerator.AllowedFailure allowedFailure) {
-//                    loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
                     continue;
                 }                    
+
                 try {
                     // create test object
                     EncryptedPrivateKeyInfo epki;
@@ -2725,34 +2565,26 @@
                     } else {
                         epki = new EncryptedPrivateKeyInfo(g.ap(), g.ct());
                     }
+
                     try {
 
-                        PKCS8EncodedKeySpec eks =
-                            epki.getKeySpec(g.pubK()==null ? g.k() : g.pubK(),
-                                    provider[l].getName());
+                        epki.getKeySpec(g.pubK()==null ? g.k() : g.pubK(),
+                                provider[l].getName());
 
-                        failed = true;
-                        failedForAlgs += algName[i][0] + ", " + algName[i][1] + "\n";
+                        fail(algName[i][0] + ", " + algName[i][1]);
 
                     } catch (InvalidKeyException e) {
-                        passedForAlgs += algName[i][0] + ", " + algName[i][1] + "\n";
                     }
                     
                     performed = true;
-                } catch (NoSuchProviderException e) {
-                    fail(getName() + ": " + e);
                 } catch (NoSuchAlgorithmException allowedFailure) {
-                    // loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure
-                    //        + ", provider=" + provider[l]);
                 }
             }
         }
-        assertFalse(failedForAlgs+passedForAlgs, failed);
         assertTrue("Test not perfrormed", performed);
-        logln(getName() + passedForAlgs);
     }
 
-    public final void testGetKeySpecKeyProvider01() {
+    public final void testGetKeySpecKeyProvider01() throws Exception {
         boolean performed = false;
         
         for (int i = 0; i < algName0.length; i++) {
@@ -2765,11 +2597,7 @@
                     // check that method under test throws NPE
                     epki.getKeySpec((Key)null, (Provider)null);
                     fail(getName() + "NullPointerException has not been thrown");
-
                 } catch (NullPointerException ok) {
-                    logln(getName() + ": " + ok);
-                } catch (InvalidKeyException e) {
-                    fail(getName() + "Unexpected exception: " + e);
                 }
 
                 try {
@@ -2790,16 +2618,11 @@
                             (Provider)null);
 
                     fail(getName() + "NullPointerException has not been thrown");
-
                 } catch (NullPointerException ok) {
-                    logln(getName() + ": " + ok);
-                } catch (InvalidKeyException e) {
-                    fail(getName() + "Unexpected exception: " + e);
                 }
 
                 performed = true;
             } catch (NoSuchAlgorithmException allowedFailure) {
-//                loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
             }
         }
         assertTrue("Test not perfrormed", performed);
@@ -2809,9 +2632,6 @@
      * Encrypted data contains valid PKCS8 key info encoding
      */
     public final void test_ROUNDTRIP_GetKeySpecKeyProvider01() {
-        boolean failed = false;
-        String failedForAlgs = "Failed for:\n";
-        String passedForAlgs = "\nPassed for:\n";
         boolean performed = false;
         
         for (int i = 0; i < algName.length; i++) {                
@@ -2825,7 +2645,6 @@
                     g = new TestDataGenerator(algName[i][0], algName[i][1],
                             privateKeyInfo, provider[l]);
                 } catch (TestDataGenerator.AllowedFailure allowedFailure) {
-//                    loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
                     continue;
                 }                    
                 try {
@@ -2842,38 +2661,25 @@
                             epki.getKeySpec(g.pubK()==null ? g.k() : g.pubK(),
                                     provider[l]);
                         
-                        if (Arrays.equals(privateKeyInfo, eks.getEncoded())) {
-                            passedForAlgs += algName[i][0] + ", " + algName[i][1] + "\n";
-                        } else {
-                            failed = true;
-                            failedForAlgs += algName[i][0] + ", " + algName[i][1] +
-                            ": comparison\n";
+                        if (!Arrays.equals(privateKeyInfo, eks.getEncoded())) {
+                            fail(algName[i][0] + " != " + algName[i][1]);
                         }
                     } catch (InvalidKeyException e) {
-                        failed = true;
-                        failedForAlgs += algName[i][0] + ", " + algName[i][1] +
-                        ": " + e + "\n";
+                        fail(algName[i][0] + ", " + algName[i][1] + ": " + e);
                     }
                     performed = true;
                     
                 } catch (NoSuchAlgorithmException allowedFailure) {
-                    // loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure
-                    //        + ", provider=" + provider[l]);
                 }
             }
         }
-        assertFalse(failedForAlgs+passedForAlgs, failed);
         assertTrue("Test not performed", performed);
-        logln(getName() + passedForAlgs);
     }
 
     /**
      * Encrypted data contains invalid PKCS8 key info encoding
      */
     public final void test_ROUNDTRIP_GetKeySpecKeyProvider02() {
-        boolean failed = false;
-        String failedForAlgs = "Failed for:\n";
-        String passedForAlgs = "\nPassed for:\n";
         boolean performed = false;
         
         for (int i = 0; i < algName.length; i++) {                
@@ -2887,9 +2693,9 @@
                     g = new TestDataGenerator(algName[i][0], algName[i][1],
                             privateKeyInfoDamaged, provider[l]);
                 } catch (TestDataGenerator.AllowedFailure allowedFailure) {
-//                    loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure);
                     continue;
                 }                    
+
                 try {
                     // create test object
                     EncryptedPrivateKeyInfo epki;
@@ -2900,26 +2706,19 @@
                     }
                     try {
                         
-                        PKCS8EncodedKeySpec eks =
-                            epki.getKeySpec(g.pubK()==null ? g.k() : g.pubK(),
-                                    provider[l]);
+                        epki.getKeySpec(g.pubK()==null ? g.k() : g.pubK(),
+                                provider[l]);
                         
-                        failed = true;
-                        failedForAlgs += algName[i][0] + ", " + algName[i][1] + "\n";
+                        fail(algName[i][0] + ", " + algName[i][1]);
 
                     } catch (InvalidKeyException e) {
-                        passedForAlgs += algName[i][0] + ", " + algName[i][1] + "\n";
                     }
                     performed = true;
                 } catch (NoSuchAlgorithmException allowedFailure) {
-                    // loglnError(getName() + " ALLOWED FAILURE: " + allowedFailure
-                    //        + ", provider=" + provider[l]);
                 }
             }
         }
-        assertFalse(failedForAlgs+passedForAlgs, failed);
         assertTrue("Test not perfrormed", performed);
-        logln(getName() + passedForAlgs);
     }
     
     //

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/ExemptionMechanismExceptionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/ExemptionMechanismExceptionTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/ExemptionMechanismExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/ExemptionMechanismExceptionTest.java Tue Jan 31 03:01:12 2006
@@ -23,7 +23,7 @@
 
 import javax.crypto.ExemptionMechanismException;
 
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
 
 
 /**
@@ -31,7 +31,7 @@
  * methods.
  * 
  */
-public class ExemptionMechanismExceptionTest extends PerformanceTest {
+public class ExemptionMechanismExceptionTest extends TestCase {
 
     public static void main(String[] args) {
     }
@@ -79,7 +79,6 @@
      */
     public void testExemptionMechanismException01() {
         ExemptionMechanismException tE = new ExemptionMechanismException();
-        assertTrue(errNotExc, tE instanceof ExemptionMechanismException);
         assertNull("getMessage() must return null.", tE.getMessage());
         assertNull("getCause() must return null", tE.getCause());
         try {
@@ -98,8 +97,6 @@
         ExemptionMechanismException tE;
         for (int i = 0; i < msgs.length; i++) {
             tE = new ExemptionMechanismException(msgs[i]);
-            assertTrue(errNotExc.concat(" (msg: ").concat(msgs[i]).concat(")"),
-                    tE instanceof ExemptionMechanismException);
             assertEquals("getMessage() must return: ".concat(msgs[i]), tE
                     .getMessage(), msgs[i]);
             assertNull("getCause() must return null", tE.getCause());
@@ -119,7 +116,6 @@
     public void testExemptionMechanismException03() {
         String msg = null;
         ExemptionMechanismException tE = new ExemptionMechanismException(msg);
-        assertTrue(errNotExc, tE instanceof ExemptionMechanismException);
         assertNull("getMessage() must return null.", tE.getMessage());
         assertNull("getCause() must return null", tE.getCause());
         try {
@@ -129,4 +125,4 @@
         }
     }
 
-}
\ No newline at end of file
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/ExemptionMechanismSpiTests.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/ExemptionMechanismSpiTests.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/ExemptionMechanismSpiTests.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/ExemptionMechanismSpiTests.java Tue Jan 31 03:01:12 2006
@@ -27,7 +27,7 @@
 import java.security.Key;
 import java.security.spec.AlgorithmParameterSpec;
 
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
 
 
 /**
@@ -36,7 +36,7 @@
  * 
  */
 
-public class ExemptionMechanismSpiTests extends PerformanceTest {
+public class ExemptionMechanismSpiTests extends TestCase {
     /**
      * Constructor for ExemptionMechanismSpiTests.
      * 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/ExemptionMechanismTest1.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/ExemptionMechanismTest1.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/ExemptionMechanismTest1.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/ExemptionMechanismTest1.java Tue Jan 31 03:01:12 2006
@@ -35,7 +35,7 @@
 import javax.crypto.spec.SecretKeySpec;
 
 import org.apache.harmony.security.SpiEngUtils;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
 
 
 /**
@@ -43,7 +43,7 @@
  * 
  */
 
-public class ExemptionMechanismTest1 extends PerformanceTest {
+public class ExemptionMechanismTest1 extends TestCase {
     
     public static final String srvExemptionMechanism = "ExemptionMechanism";
     
@@ -366,4 +366,4 @@
             throw new RuntimeException("finalize was broken", e);
         }
     }
-}
\ No newline at end of file
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/IllegalBlockSizeExceptionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/IllegalBlockSizeExceptionTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/IllegalBlockSizeExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/IllegalBlockSizeExceptionTest.java Tue Jan 31 03:01:12 2006
@@ -23,7 +23,7 @@
 
 import javax.crypto.IllegalBlockSizeException;
 
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
 
 
 /**
@@ -31,7 +31,7 @@
  * methods.
  * 
  */
-public class IllegalBlockSizeExceptionTest extends PerformanceTest {
+public class IllegalBlockSizeExceptionTest extends TestCase {
 
     public static void main(String[] args) {
     }
@@ -79,7 +79,6 @@
      */
     public void testIllegalBlockSizeException01() {
         IllegalBlockSizeException tE = new IllegalBlockSizeException();
-        assertTrue(errNotExc, tE instanceof IllegalBlockSizeException);
         assertNull("getMessage() must return null.", tE.getMessage());
         assertNull("getCause() must return null", tE.getCause());
         try {
@@ -98,8 +97,6 @@
         IllegalBlockSizeException tE;
         for (int i = 0; i < msgs.length; i++) {
             tE = new IllegalBlockSizeException(msgs[i]);
-            assertTrue(errNotExc.concat(" (msg: ").concat(msgs[i]).concat(")"),
-                    tE instanceof IllegalBlockSizeException);
             assertEquals("getMessage() must return: ".concat(msgs[i]), tE
                     .getMessage(), msgs[i]);
             assertNull("getCause() must return null", tE.getCause());
@@ -119,7 +116,6 @@
     public void testIllegalBlockSizeException03() {
         String msg = null;
         IllegalBlockSizeException tE = new IllegalBlockSizeException(msg);
-        assertTrue(errNotExc, tE instanceof IllegalBlockSizeException);
         assertNull("getMessage() must return null.", tE.getMessage());
         assertNull("getCause() must return null", tE.getCause());
         try {
@@ -129,4 +125,4 @@
         }
     }
 
-}
\ No newline at end of file
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/KeyAgreementTest1.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/KeyAgreementTest1.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/KeyAgreementTest1.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/KeyAgreementTest1.java Tue Jan 31 03:01:12 2006
@@ -38,7 +38,7 @@
 
 import org.apache.harmony.security.SpiEngUtils;
 import org.apache.harmony.security.TestKeyPair;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
 
 
 /**
@@ -46,7 +46,7 @@
  * 
  */
 
-public class KeyAgreementTest1 extends PerformanceTest {
+public class KeyAgreementTest1 extends TestCase {
 
     /**
      * Constructor for KeyAgreementTest1.
@@ -87,40 +87,27 @@
         defaultProviderName = (DEFSupported ? defaultProvider.getName() : null);
     }
 
-    private boolean createKeys() {
-        if (initKeys) {
-            return true;
-        }
-        try {
+    private void createKeys() throws Exception {
+        if (!initKeys) {
             TestKeyPair tkp = new TestKeyPair(defaultAlgorithm);
             privKey = tkp.getPrivate();
             publKey = tkp.getPublic();
             initKeys = true;
-            return true;
-        } catch (Exception e) {
-            logln("Unexpected: " + e.toString());
-            initKeys = false;
-            return false;
         }
 
     }
 
-    private KeyAgreement[] createKAs() {
+    private KeyAgreement[] createKAs() throws Exception {
         if (!DEFSupported) {
             fail(NotSupportMsg);
-            return null;
-        }
-        try {
-            KeyAgreement[] ka = new KeyAgreement[3];
-            ka[0] = KeyAgreement.getInstance(defaultAlgorithm);
-            ka[1] = KeyAgreement.getInstance(defaultAlgorithm, defaultProvider);
-            ka[2] = KeyAgreement.getInstance(defaultAlgorithm,
-                    defaultProviderName);
-            return ka;
-        } catch (Exception e) {
-            logln(e.toString());
-            return null;
         }
+
+        KeyAgreement[] ka = new KeyAgreement[3];
+        ka[0] = KeyAgreement.getInstance(defaultAlgorithm);
+        ka[1] = KeyAgreement.getInstance(defaultAlgorithm, defaultProvider);
+        ka[2] = KeyAgreement.getInstance(defaultAlgorithm,
+                defaultProviderName);
+        return ka;
     }
 
     public static String getDefAlg() {
@@ -140,7 +127,6 @@
         KeyAgreementSpi spi = new MyKeyAgreementSpi();
         KeyAgreement keyA = new myKeyAgreement(spi, defaultProvider,
                 defaultAlgorithm);
-        assertTrue("Not KeyAgreement object", keyA instanceof KeyAgreement);
         assertEquals("Incorrect algorithm", keyA.getAlgorithm(),
                 defaultAlgorithm);
         assertEquals("Incorrect provider", keyA.getProvider(), defaultProvider);
@@ -148,7 +134,6 @@
         assertEquals("Incorrect result", keyA.generateSecret().length, 0);
 
         keyA = new myKeyAgreement(null, null, null);
-        assertTrue("Not KeyAgreement object", keyA instanceof KeyAgreement);
         assertNull("Algorithm must be null", keyA.getAlgorithm());
         assertNull("Provider must be null", keyA.getProvider());
         try {
@@ -191,7 +176,6 @@
         KeyAgreement keyA;
         for (int i = 0; i < validValues.length; i++) {
             keyA = KeyAgreement.getInstance(validValues[i]);
-            assertTrue("Not KeyAgreement object", keyA instanceof KeyAgreement);
             assertEquals("Incorrect algorithm", keyA.getAlgorithm(),
                     validValues[i]);
         }
@@ -276,7 +260,6 @@
         for (int i = 0; i < validValues.length; i++) {
             keyA = KeyAgreement
                     .getInstance(validValues[i], defaultProviderName);
-            assertTrue("Not KeyAgreement object", keyA instanceof KeyAgreement);
             assertEquals("Incorrect algorithm", keyA.getAlgorithm(),
                     validValues[i]);
             assertEquals("Incorrect provider", keyA.getProvider().getName(),
@@ -343,7 +326,6 @@
         KeyAgreement keyA;
         for (int i = 0; i < validValues.length; i++) {
             keyA = KeyAgreement.getInstance(validValues[i], defaultProvider);
-            assertTrue("Not KeyAgreement object", keyA instanceof KeyAgreement);
             assertEquals("Incorrect algorithm", keyA.getAlgorithm(),
                     validValues[i]);
             assertEquals("Incorrect provider", keyA.getProvider(),
@@ -360,18 +342,16 @@
      * sharedsecret in buffer and return numbers of bytes; returns SecretKey
      * object
      */
-    public void testGenerateSecret03() throws ShortBufferException,
-            InvalidKeyException, NoSuchAlgorithmException {
+    public void testGenerateSecret03() throws Exception {
         if (!DEFSupported) {
             fail(NotSupportMsg);
             return;
         }
-        assertTrue("Keys were not created", createKeys());
+        createKeys();
         KeyAgreement[] kAgs = createKAs();
-        assertNotNull("KeyAgreement objects were not created", kAgs);
+
         byte[] bb;
         byte[] bb1 = new byte[10];
-        int t;
         for (int i = 0; i < kAgs.length; i++) {
             kAgs[i].init(privKey);
             kAgs[i].doPhase(publKey, true);
@@ -379,11 +359,10 @@
             kAgs[i].init(privKey);
             kAgs[i].doPhase(publKey, true);
             bb1 = new byte[bb.length + 10];
-            t = kAgs[i].generateSecret(bb1, 9);
+            kAgs[i].generateSecret(bb1, 9);
             kAgs[i].init(privKey);
             kAgs[i].doPhase(publKey, true);
-            assertTrue("Not SecretKey object",
-                    kAgs[i].generateSecret("DES") instanceof SecretKey);
+            kAgs[i].generateSecret("DES");
         }
     }
 
@@ -391,15 +370,14 @@
      * Test for <code>doPhase(Key key, boolean lastPhase)</code> method
      * Assertion: throws InvalidKeyException if key is not appropriate
      */
-    public void testDoPhase() throws ShortBufferException, InvalidKeyException,
-            NoSuchAlgorithmException {
+    public void testDoPhase() throws Exception {
         if (!DEFSupported) {
             fail(NotSupportMsg);
             return;
         }
-        assertTrue("Keys were not created", createKeys());
+        createKeys();
         KeyAgreement[] kAgs = createKAs();
-        assertNotNull("KeyAgreement objects were not created", kAgs);
+
         for (int i = 0; i < kAgs.length; i++) {
             kAgs[i].init(privKey);
             try {
@@ -423,15 +401,14 @@
      * <code>init(Key key, AlgorithmParameterSpec params, SecureRandom random)</code>
      * Assertion: throws InvalidKeyException when key is inapporopriate
      */
-    public void testInit01() throws InvalidAlgorithmParameterException,
-            InvalidKeyException {
+    public void testInit01() throws Exception {
         if (!DEFSupported) {
             fail(NotSupportMsg);
             return;
         }
-        assertTrue("Keys were not created", createKeys());
+        createKeys();
         KeyAgreement[] kAgs = createKAs();
-        assertNotNull("KeyAgreement objects were not created", kAgs);
+
         SecureRandom random = null;
         AlgorithmParameterSpec aps = null;
         DHParameterSpec dhPs = new DHParameterSpec(new BigInteger("56"),
@@ -477,16 +454,15 @@
      * Assertion: throws AlgorithmParameterException when params are
      * inapporopriate
      */
-    public void testInit02() throws InvalidKeyException {
+    public void testInit02() throws Exception {
         if (!DEFSupported) {
             fail(NotSupportMsg);
             return;
         }
-        assertTrue("Keys were not created", createKeys());
+        createKeys();
         KeyAgreement[] kAgs = createKAs();
-        assertNotNull("KeyAgreement objects were not created", kAgs);
+
         SecureRandom random = null;
-        AlgorithmParameterSpec aps = null;
         DSAParameterSpec dsa = new DSAParameterSpec(new BigInteger("56"),
                 new BigInteger("56"), new BigInteger("56"));
         for (int i = 0; i < kAgs.length; i++) {
@@ -518,19 +494,17 @@
      * <code>generateSecret()</code>
      * Assertions: initializes KeyAgreement and returns byte array
      */
-    public void testInit03() throws InvalidKeyException {
+    public void testInit03() throws Exception {
         if (!DEFSupported) {
             fail(NotSupportMsg);
             return;
         }
-        assertTrue("Keys were not created", createKeys());
+        createKeys();
         KeyAgreement[] kAgs = createKAs();
-        assertNotNull("KeyAgreement objects were not created", kAgs);
+
         byte[] bbRes1;
         byte[] bbRes2;
         byte[] bbRes3;
-        byte[] bb1 = new byte[10];
-        int t;
         SecureRandom randomNull = null;
         SecureRandom random = new SecureRandom();
         for (int i = 0; i < kAgs.length; i++) {
@@ -565,22 +539,20 @@
      * <code>generateSecret()</code>
      * Assertions: initializes KeyAgreement and returns byte array
      */
-    public void testInit04() throws InvalidKeyException,
+    public void testInit04() throws Exception,
             InvalidAlgorithmParameterException {
         if (!DEFSupported) {
             fail(NotSupportMsg);
             return;
         }
-        assertTrue("Keys were not created", createKeys());
+        createKeys();
         KeyAgreement[] kAgs = createKAs();
-        assertNotNull("KeyAgreement objects were not created", kAgs);
+
         DHParameterSpec dhPs = ((DHPrivateKey) privKey).getParams();
 
         byte[] bbRes1;
         byte[] bbRes2;
         byte[] bbRes3;
-        byte[] bb1 = new byte[10];
-        int t;
         SecureRandom randomNull = null;
         SecureRandom random = new SecureRandom();
         for (int i = 0; i < kAgs.length; i++) {
@@ -623,4 +595,4 @@
             String algorithm) {
         super(keyAgreeSpi, provider, algorithm);
     }
-}
\ No newline at end of file
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/KeyAgreementTest2.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/KeyAgreementTest2.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/KeyAgreementTest2.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/KeyAgreementTest2.java Tue Jan 31 03:01:12 2006
@@ -34,7 +34,7 @@
 import java.security.spec.KeySpec;
 
 import org.apache.harmony.security.SpiEngUtils;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
 
 
 /**
@@ -42,7 +42,7 @@
  * 
  */
 
-public class KeyAgreementTest2 extends PerformanceTest {
+public class KeyAgreementTest2 extends TestCase {
     
     private static final String defaultAlg = "MyKeyAgr";
     
@@ -149,8 +149,6 @@
         KeyAgreement keyAgr;
         for (int i = 0; i < validValues.length; i++) {
             keyAgr = KeyAgreement.getInstance(validValues[i]);
-            assertTrue("Not instanceof KeyAgreement object",
-                    keyAgr instanceof KeyAgreement);
             assertEquals("Incorrect algorithm", keyAgr.getAlgorithm(),
                     validValues[i]);
             assertEquals("Incorrect provider", keyAgr.getProvider(), mProv);
@@ -215,8 +213,6 @@
         for (int i = 0; i < validValues.length; i++) {
             keyAgr = KeyAgreement.getInstance(validValues[i], mProv
                     .getName());
-            assertTrue("Not instanceof KeyAgreement object",
-                    keyAgr instanceof KeyAgreement);
             assertEquals("Incorrect algorithm", keyAgr.getAlgorithm(),
                     validValues[i]);
             assertEquals("Incorrect provider", keyAgr.getProvider().getName(),
@@ -267,12 +263,10 @@
         KeySpec keySpec;
         for (int i = 0; i < validValues.length; i++) {
             keyAgr = KeyAgreement.getInstance(validValues[i], mProv);
-            assertTrue("Not instanceof KeyAgreement object",
-                    keyAgr instanceof KeyAgreement);
             assertEquals("Incorrect algorithm", keyAgr.getAlgorithm(),
                     validValues[i]);
             assertEquals("Incorrect provider", keyAgr.getProvider(), mProv);
             checkResult(keyAgr);
        }
     }
-}
\ No newline at end of file
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/KeyGeneratorSpiTests.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/KeyGeneratorSpiTests.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/KeyGeneratorSpiTests.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/KeyGeneratorSpiTests.java Tue Jan 31 03:01:12 2006
@@ -28,14 +28,14 @@
 
 import java.security.spec.AlgorithmParameterSpec;
 
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
 
 /**
  * Tests for <code>KeyGeneratorSpi</code> class constructors and methods.
  * 
  */
 
-public class KeyGeneratorSpiTests extends PerformanceTest {
+public class KeyGeneratorSpiTests extends TestCase {
 
     /**
      * Constructor for KeyGeneratorSpiTests.
@@ -77,4 +77,4 @@
 }
 class APSpecSpi implements AlgorithmParameterSpec {
     
-}
\ No newline at end of file
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/KeyGeneratorTest1.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/KeyGeneratorTest1.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/KeyGeneratorTest1.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/KeyGeneratorTest1.java Tue Jan 31 03:01:12 2006
@@ -30,7 +30,7 @@
 import java.security.spec.AlgorithmParameterSpec;
 
 import org.apache.harmony.security.SpiEngUtils;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
 
 
 /**
@@ -38,7 +38,7 @@
  * 
  */
 
-public class KeyGeneratorTest1 extends PerformanceTest {
+public class KeyGeneratorTest1 extends TestCase {
 
     /**
      * Constructor for KeyGeneratorTest1.
@@ -89,21 +89,16 @@
         }
     }
     
-    private KeyGenerator[] createKGs() {
+    private KeyGenerator[] createKGs() throws Exception {
         if (!DEFSupported) {
             fail(NotSupportMsg);
-            return null;
-        }
-        try {
-            KeyGenerator [] kg = new KeyGenerator[3];
-            kg[0] = KeyGenerator.getInstance(defaultAlgorithm);
-            kg[1] = KeyGenerator.getInstance(defaultAlgorithm, defaultProvider);
-            kg[2] = KeyGenerator.getInstance(defaultAlgorithm, defaultProviderName);
-            return kg;
-        } catch (Exception e) {
-            logln(e.toString());
-            return null;
         }
+
+        KeyGenerator [] kg = new KeyGenerator[3];
+        kg[0] = KeyGenerator.getInstance(defaultAlgorithm);
+        kg[1] = KeyGenerator.getInstance(defaultAlgorithm, defaultProvider);
+        kg[2] = KeyGenerator.getInstance(defaultAlgorithm, defaultProviderName);
+        return kg;
     }
 
 
@@ -120,7 +115,6 @@
         KeyGeneratorSpi spi = new MyKeyGeneratorSpi();
         KeyGenerator keyG = new myKeyGenerator(spi, defaultProvider,
                 defaultAlgorithm);
-        assertTrue("Not KeyGenerator object", keyG instanceof KeyGenerator);
         assertEquals("Incorrect algorithm", keyG.getAlgorithm(),
                 defaultAlgorithm);
         assertEquals("Incorrect provider", keyG.getProvider(), defaultProvider);
@@ -137,7 +131,6 @@
         } catch (IllegalArgumentException e) {
         }
         keyG = new myKeyGenerator(null, null, null);
-        assertTrue("Not KeyGenerator object", keyG instanceof KeyGenerator);
         assertNull("Algorithm must be null", keyG.getAlgorithm());
         assertNull("Provider must be null", keyG.getProvider());
 
@@ -187,7 +180,6 @@
         KeyGenerator keyG;
         for (int i = 0; i < validValues.length; i++) {
             keyG = KeyGenerator.getInstance(validValues[i]);
-            assertTrue("Not KeyGenerator object", keyG instanceof KeyGenerator);
             assertEquals("Incorrect algorithm", keyG.getAlgorithm(), validValues[i]);
         }
     }
@@ -269,7 +261,6 @@
         KeyGenerator keyG;
         for (int i = 0; i < validValues.length; i++) {
             keyG = KeyGenerator.getInstance(validValues[i], defaultProviderName);
-            assertTrue("Not KeyGenerator object", keyG instanceof KeyGenerator);
             assertEquals("Incorrect algorithm", keyG.getAlgorithm(), validValues[i]);
             assertEquals("Incorrect provider", keyG.getProvider().getName(), defaultProviderName);
         }
@@ -335,7 +326,6 @@
         KeyGenerator keyA;
         for (int i = 0; i < validValues.length; i++) {
             keyA = KeyGenerator.getInstance(validValues[i], defaultProvider);
-            assertTrue("Not KeyGenerator object", keyA instanceof KeyGenerator);
             assertEquals("Incorrect algorithm", keyA.getAlgorithm(), validValues[i]);
             assertEquals("Incorrect provider", keyA.getProvider(), defaultProvider);
         }
@@ -347,7 +337,7 @@
      * Assertion: throws InvalidParameterException if keysize is wrong
      * 
      */    
-    public void testInitKey() {
+    public void testInitKey() throws Exception {
         if (!DEFSupported) {
             fail(NotSupportMsg);
             return;
@@ -358,21 +348,18 @@
         }
         int[] size = { Integer.MIN_VALUE, -1, 0, Integer.MAX_VALUE };
         KeyGenerator[] kgs = createKGs();
-        assertNotNull("KeyGenerator objects were not created", kgs);
         SecureRandom random = new SecureRandom();
+
         for (int i = 0; i < kgs.length; i++) {
             for (int j = 0; j < size.length; j++) {
                 try {
                     kgs[i].init(size[j]);
-                    logln("Ignore key size: "+size[j]);
-                } catch (InvalidParameterException e) {
+                } catch (InvalidParameterException ignore) {
                 }
-            }
-            for (int j = 0; j < size.length; j++) {
+
                 try {
                     kgs[i].init(size[j], random);
-                    logln("Ignore key size: "+size[j]);
-                } catch (InvalidParameterException e) {
+                } catch (InvalidParameterException ignore) {
                 }
             }
         }
@@ -383,14 +370,14 @@
      * <code>init(AlgorithmParameterSpec params, SecureRandom random)</code> methods
      * Assertion: throws InvalidAlgorithmParameterException when params is null
      */
-    public void testInitParams() {
+    public void testInitParams() throws Exception {
         if (!DEFSupported) {
             fail(NotSupportMsg);
             return;
         }
         KeyGenerator [] kgs = createKGs();
-        assertNotNull("KeyGenerator objects were not created", kgs);
         AlgorithmParameterSpec aps = null;
+
         for (int i = 0; i < kgs.length; i++) {
             try {
                 kgs[i].init(aps);
@@ -417,7 +404,7 @@
      * returns SecretKey object
      * 
      */ 
-    public void testGenerateKey() throws NoSuchAlgorithmException {
+    public void testGenerateKey() throws Exception {
         if (!DEFSupported) {
             fail(NotSupportMsg);
             return;
@@ -426,25 +413,21 @@
         String dAl = defaultAlgorithm.toUpperCase();
 
         KeyGenerator[] kgs = createKGs();
-        assertNotNull("KeyGenerator objects were not created", kgs);
+
         for (int i = 0; i < kgs.length; i++) {
             sKey = kgs[i].generateKey();
-            assertTrue("Not SecretKey object", sKey instanceof SecretKey);
             assertEquals("Incorect algorithm", sKey.getAlgorithm()
                     .toUpperCase(), dAl);
             kgs[i].init(new SecureRandom());
             sKey = kgs[i].generateKey();
-            assertTrue("Not SecretKey object", sKey instanceof SecretKey);
             assertEquals("Incorect algorithm", sKey.getAlgorithm()
                     .toUpperCase(), dAl);
             kgs[i].init(defaultKeySize);
             sKey = kgs[i].generateKey();
-            assertTrue("Not SecretKey object", sKey instanceof SecretKey);
             assertEquals("Incorect algorithm", sKey.getAlgorithm()
                     .toUpperCase(), dAl);
             kgs[i].init(defaultKeySize, new SecureRandom());
             sKey = kgs[i].generateKey();
-            assertTrue("Not SecretKey object", sKey instanceof SecretKey);
             assertEquals("Incorect algorithm", sKey.getAlgorithm()
                     .toUpperCase(), dAl);
         }
@@ -464,4 +447,4 @@
             String algorithm) {
         super(keyAgreeSpi, provider, algorithm);
     }
-}
\ No newline at end of file
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/KeyGeneratorTest2.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/KeyGeneratorTest2.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/KeyGeneratorTest2.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/KeyGeneratorTest2.java Tue Jan 31 03:01:12 2006
@@ -33,7 +33,7 @@
 import java.security.spec.KeySpec;
 
 import org.apache.harmony.security.SpiEngUtils;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
 
 
 /**
@@ -41,7 +41,7 @@
  * 
  */
 
-public class KeyGeneratorTest2 extends PerformanceTest {
+public class KeyGeneratorTest2 extends TestCase {
     
     private static final String defaultAlg = "MyKeyGen";
     
@@ -154,8 +154,6 @@
         KeyGenerator keyGen;
         for (int i = 0; i < validValues.length; i++) {
             keyGen = KeyGenerator.getInstance(validValues[i]);
-            assertTrue("Not instanceof KeyGenerator object",
-                    keyGen instanceof KeyGenerator);
             assertEquals("Incorrect algorithm", keyGen.getAlgorithm(),
                     validValues[i]);
             assertEquals("Incorrect provider", keyGen.getProvider(), mProv);
@@ -220,8 +218,6 @@
         for (int i = 0; i < validValues.length; i++) {
             keyGen = KeyGenerator.getInstance(validValues[i], mProv
                     .getName());
-            assertTrue("Not instanceof KeyGenerator object",
-                    keyGen instanceof KeyGenerator);
             assertEquals("Incorrect algorithm", keyGen.getAlgorithm(),
                     validValues[i]);
             assertEquals("Incorrect provider", keyGen.getProvider().getName(),
@@ -270,8 +266,6 @@
         KeySpec keySpec;
         for (int i = 0; i < validValues.length; i++) {
             keyGen = KeyGenerator.getInstance(validValues[i], mProv);
-            assertTrue("Not instanceof KeyGenerator object",
-                    keyGen instanceof KeyGenerator);
             assertEquals("Incorrect algorithm", keyGen.getAlgorithm(),
                     validValues[i]);
             assertEquals("Incorrect provider", keyGen.getProvider(), mProv);
@@ -282,4 +276,4 @@
 
 class APSpec implements AlgorithmParameterSpec {
     
-}
\ No newline at end of file
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/MacSpiTests.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/MacSpiTests.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/MacSpiTests.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/javax/crypto/MacSpiTests.java Tue Jan 31 03:01:12 2006
@@ -30,7 +30,7 @@
 
 import javax.crypto.spec.SecretKeySpec;
 
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
 
 
 /**
@@ -38,7 +38,7 @@
  * 
  */
 
-public class MacSpiTests extends PerformanceTest {
+public class MacSpiTests extends TestCase {
 
     /**
      * Constructor for MacSpiTests.
@@ -53,14 +53,12 @@
      * Test for <code>MacSpi</code> constructor 
      * Assertion: constructs MacSpi
      */
-    public void testMacSpiTests01() throws CloneNotSupportedException,
-    InvalidKeyException, InvalidAlgorithmParameterException {
-        MacSpi mSpi = (MacSpi) new MyMacSpi();
+    public void testMacSpiTests01() throws Exception {
+        MacSpi mSpi = new MyMacSpi();
                 
         byte [] bb1 = {(byte)1, (byte)2, (byte)3, (byte)4, (byte)5};
         SecretKeySpec sks = new SecretKeySpec(bb1, "SHA1");        
         
-        assertTrue("Not MacSpi object", mSpi instanceof MacSpi);
         assertEquals("Incorrect MacLength", mSpi.engineGetMacLength(), 0);
         
         try {
@@ -79,8 +77,7 @@
         } catch (CloneNotSupportedException e) {
         }
         
-        MacSpi mSpi1 = (MacSpi) new MyMacSpi1();
-        assertTrue("Not MacSpi object", mSpi1 instanceof MacSpi);
+        MacSpi mSpi1 = new MyMacSpi1();
         mSpi1.clone();
         
         byte [] bbb = new byte[10];
@@ -102,16 +99,16 @@
         bb = mSpi1.engineDoFinal();
         assertEquals("Incorrect result of engineDoFinal", bb.length, beforeUp);
         
-        MacSpi mSpi2 = (MacSpi) new MyMacSpi2();
-        assertTrue("Not MacSpi object", mSpi2 instanceof MacSpi);
+        MacSpi mSpi2 = new MyMacSpi2();
         
         mSpi2.engineInit(null, null);
         mSpi2.engineInit(sks, null);
+
         try {
-            assertTrue((MacSpi)mSpi2.clone() instanceof MacSpi);
+            mSpi2.clone();
         } catch (CloneNotSupportedException e) {
-            logln("clone() is not supported");
         }
+
         byte [] bbuf = {(byte)5, (byte)4, (byte)3, (byte)2, (byte)1};
         byteBuf = ByteBuffer.allocate(5);        
         byteBuf.put(bbuf);
@@ -150,4 +147,4 @@
 
     protected void engineReset() {
     }
-}
\ No newline at end of file
+}



Mime
View raw message