Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 34404 invoked from network); 22 May 2006 10:17:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 22 May 2006 10:17:18 -0000 Received: (qmail 37131 invoked by uid 500); 22 May 2006 10:17:07 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 37041 invoked by uid 500); 22 May 2006 10:17:07 -0000 Mailing-List: contact harmony-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-commits@incubator.apache.org Received: (qmail 36987 invoked by uid 99); 22 May 2006 10:17:07 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 May 2006 03:17:07 -0700 X-ASF-Spam-Status: No, hits=0.6 required=10.0 tests=NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 May 2006 03:17:06 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 053B31A9842; Mon, 22 May 2006 03:16:45 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r408629 - /incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/java/security/cert/TrustAnchorTest.java Date: Mon, 22 May 2006 10:16:44 -0000 To: harmony-commits@incubator.apache.org From: smishura@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060522101645.053B31A9842@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: smishura Date: Mon May 22 03:16:40 2006 New Revision: 408629 URL: http://svn.apache.org/viewvc?rev=408629&view=rev Log: Utilizing JUnit's exception handling Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/java/security/cert/TrustAnchorTest.java Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/java/security/cert/TrustAnchorTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/java/security/cert/TrustAnchorTest.java?rev=408629&r1=408628&r2=408629&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/java/security/cert/TrustAnchorTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/java/security/cert/TrustAnchorTest.java Mon May 22 03:16:40 2006 @@ -23,7 +23,6 @@ import java.security.KeyStore; import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; import java.security.PublicKey; import java.security.spec.InvalidKeySpecException; import java.util.Arrays; @@ -405,13 +404,9 @@ * @throws InvalidKeySpecException */ public final void testTrustAnchorStringPublicKeybyteArray01() - throws InvalidKeySpecException { - PublicKey pk = null; - try { - pk = new TestKeyPair(keyAlg).getPublic(); - } catch (NoSuchAlgorithmException e) { - fail(getName() + ": not performed (could not create test PublicKey)"); - } + throws Exception { + + PublicKey pk = new TestKeyPair(keyAlg).getPublic(); // sub testcase 1 new TrustAnchor(validCaNameRfc2253, pk, getFullEncoding()); @@ -431,14 +426,9 @@ * @throws InvalidKeySpecException */ public final void testTrustAnchorStringPublicKeybyteArray02() - throws InvalidKeySpecException { - PublicKey pk = null; - try { - pk = new TestKeyPair(keyAlg).getPublic(); - } catch (NoSuchAlgorithmException e) { - fail(getName() + ": not performed (could not create test PublicKey)"); - } + throws Exception { + PublicKey pk = new TestKeyPair(keyAlg).getPublic(); new TrustAnchor(validCaNameRfc2253, pk, null); } @@ -451,13 +441,9 @@ * @throws InvalidKeySpecException */ public final void testTrustAnchorStringPublicKeybyteArray03() - throws InvalidKeySpecException { - PublicKey pk = null; - try { - pk = new TestKeyPair(keyAlg).getPublic(); - } catch (NoSuchAlgorithmException e) { - fail(getName() + ": not performed (could not create test PublicKey)"); - } + throws Exception { + + PublicKey pk = new TestKeyPair(keyAlg).getPublic(); byte[] nc = getEncodingPSOnly(); byte[] ncCopy = (byte[])nc.clone(); @@ -479,13 +465,9 @@ * @throws InvalidKeySpecException */ public final void testTrustAnchorStringPublicKeybyteArray04() - throws InvalidKeySpecException { - PublicKey pk = null; - try { - pk = new TestKeyPair(keyAlg).getPublic(); - } catch (NoSuchAlgorithmException e) { - fail(getName() + ": not performed (could not create test PublicKey)"); - } + throws Exception { + + PublicKey pk = new TestKeyPair(keyAlg).getPublic(); // sub testcase 1 try { @@ -517,13 +499,9 @@ * @throws InvalidKeySpecException */ public final void testTrustAnchorX500PrincipalPublicKeybyteArray01() - throws InvalidKeySpecException { - PublicKey pk = null; - try { - pk = new TestKeyPair(keyAlg).getPublic(); - } catch (NoSuchAlgorithmException e) { - fail(getName() + ": not performed (could not create test PublicKey)"); - } + throws Exception { + + PublicKey pk = new TestKeyPair(keyAlg).getPublic(); X500Principal x500p = new X500Principal(validCaNameRfc2253); // sub testcase 1 @@ -544,13 +522,9 @@ * @throws InvalidKeySpecException */ public final void testTrustAnchorX500PrincipalPublicKeybyteArray02() - throws InvalidKeySpecException { - PublicKey pk = null; - try { - pk = new TestKeyPair(keyAlg).getPublic(); - } catch (NoSuchAlgorithmException e) { - fail(getName() + ": not performed (could not create test PublicKey)"); - } + throws Exception { + + PublicKey pk = new TestKeyPair(keyAlg).getPublic(); X500Principal x500p = new X500Principal(validCaNameRfc2253); @@ -565,13 +539,9 @@ * @throws InvalidKeySpecException */ public final void testTrustAnchorX500PrincipalPublicKeybyteArray03() - throws InvalidKeySpecException { - PublicKey pk = null; - try { - pk = new TestKeyPair(keyAlg).getPublic(); - } catch (NoSuchAlgorithmException e) { - fail(getName() + ": not performed (could not create test PublicKey)"); - } + throws Exception { + + PublicKey pk = new TestKeyPair(keyAlg).getPublic(); byte[] nc = getEncodingPSOnly(); byte[] ncCopy = (byte[])nc.clone(); @@ -594,13 +564,9 @@ * @throws InvalidKeySpecException */ public final void testTrustAnchorX500PrincipalPublicKeybyteArray04() - throws InvalidKeySpecException { - PublicKey pk = null; - try { - pk = new TestKeyPair(keyAlg).getPublic(); - } catch (NoSuchAlgorithmException e) { - fail(getName() + ": not performed (could not create test PublicKey)"); - } + throws Exception { + + PublicKey pk = new TestKeyPair(keyAlg).getPublic(); X500Principal x500p = new X500Principal(validCaNameRfc2253); // sub testcase 1 @@ -665,13 +631,9 @@ * Expected: the same name must be returned by the method
* */ - public final void testGetCAPublicKey01() throws InvalidKeySpecException { - PublicKey pk = null; - try { - pk = new TestKeyPair(keyAlg).getPublic(); - } catch (NoSuchAlgorithmException e) { - fail(getName() + ": not performed (could not create test PublicKey)"); - } + public final void testGetCAPublicKey01() throws Exception { + + PublicKey pk = new TestKeyPair(keyAlg).getPublic(); // sub testcase 1 TrustAnchor ta = @@ -715,13 +677,9 @@ * Expected: the same name must be returned by the method
* @throws InvalidKeySpecException */ - public final void testGetCAName01() throws InvalidKeySpecException { - PublicKey pk = null; - try { - pk = new TestKeyPair(keyAlg).getPublic(); - } catch (NoSuchAlgorithmException e) { - fail(getName() + ": not performed (could not create test PublicKey)"); - } + public final void testGetCAName01() throws Exception { + + PublicKey pk = new TestKeyPair(keyAlg).getPublic(); // sub testcase 1 TrustAnchor ta = @@ -787,14 +745,9 @@ * Expected: null as return value
* @throws InvalidKeySpecException */ - public final void testGetTrustedCer02() - throws InvalidKeySpecException { - PublicKey pk = null; - try { - pk = new TestKeyPair(keyAlg).getPublic(); - } catch (NoSuchAlgorithmException e) { - fail(getName() + ": not performed (could not create test PublicKey)"); - } + public final void testGetTrustedCer02() throws Exception { + + PublicKey pk = new TestKeyPair(keyAlg).getPublic(); // sub testcase 1 TrustAnchor ta = @@ -816,13 +769,9 @@ * by the method
* @throws InvalidKeySpecException */ - public final void testGetCA01() throws InvalidKeySpecException { - PublicKey pk = null; - try { - pk = new TestKeyPair(keyAlg).getPublic(); - } catch (NoSuchAlgorithmException e) { - fail(getName() + ": not performed (could not create test PublicKey)"); - } + public final void testGetCA01() throws Exception { + + PublicKey pk = new TestKeyPair(keyAlg).getPublic(); // sub testcase 1 TrustAnchor ta = @@ -865,8 +814,8 @@ * Test preconditions: several valid test objects created
* Expected: method returns not null in all cases
*/ - public final void testToString() - throws KeyStoreException, InvalidKeySpecException { + public final void testToString() throws Exception { + KeyStore ks = TestUtils.getKeyStore(true, TestUtils.TRUSTED); if (ks == null) { fail(getName() + ": not performed (could not create test KeyStore)"); @@ -881,12 +830,7 @@ assertNotNull("#1", ta.toString()); - PublicKey pk = null; - try { - pk = new TestKeyPair(keyAlg).getPublic(); - } catch (NoSuchAlgorithmException e) { - fail(getName() + ": not performed (could not create test PublicKey)"); - } + PublicKey pk = new TestKeyPair(keyAlg).getPublic(); // sub testcase 2