Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 11008 invoked from network); 18 Aug 2006 09:53:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 18 Aug 2006 09:53:55 -0000 Received: (qmail 21084 invoked by uid 500); 18 Aug 2006 09:53:55 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 21046 invoked by uid 500); 18 Aug 2006 09:53:55 -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 21035 invoked by uid 99); 18 Aug 2006 09:53:55 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Aug 2006 02:53:55 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,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; Fri, 18 Aug 2006 02:53:54 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 3AFCC1A981A; Fri, 18 Aug 2006 02:53:34 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r432536 - /incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/serialization/CertificateTest.java Date: Fri, 18 Aug 2006 09:53:32 -0000 To: harmony-commits@incubator.apache.org From: smishura@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060818095334.3AFCC1A981A@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: Fri Aug 18 02:53:30 2006 New Revision: 432536 URL: http://svn.apache.org/viewvc?rev=432536&view=rev Log: Utilize JUnit's exception handling + remove logging Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/serialization/CertificateTest.java Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/serialization/CertificateTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/serialization/CertificateTest.java?rev=432536&r1=432535&r2=432536&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/serialization/CertificateTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/serialization/CertificateTest.java Fri Aug 18 02:53:30 2006 @@ -23,8 +23,6 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; @@ -32,19 +30,16 @@ import java.io.ObjectStreamException; import java.io.OutputStream; import java.security.cert.Certificate; -import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; +import junit.framework.TestCase; + import org.apache.harmony.security.tests.support.cert.MyCertificate; import org.apache.harmony.security.tests.support.cert.TestUtils; import org.apache.harmony.testframework.serialization.SerializationTest; -import junit.framework.TestCase; - - /** * Tests for Certificate serialization - * */ public class CertificateTest extends TestCase { @@ -82,16 +77,8 @@ * * Assertion: ObjectStreamException if a CertPath could not * be constructed - * - * @throws CertificateException - * @throws IOException - * @throws ClassNotFoundException - */ - public final void testSerialization03() - throws CertificateException, - IOException, - ClassNotFoundException { - boolean passed = false; + */ + public final void testCertificateRep_readResolve() throws Exception { // Create object to be serialized Certificate c1 = new MyCertificate("DUMMY", new byte[] {(byte)0, (byte)1}); // This testcase uses ByteArray streams @@ -101,29 +88,17 @@ // try to deserialize it try { deserialize(new ByteArrayInputStream(bos.toByteArray())); - } catch (Exception e) { - System.out.println(getName() + ": " + e); - if (e instanceof ObjectStreamException) { - passed = true; - } + fail("No expected ObjectStreamException"); + } catch (ObjectStreamException e) { } - // check that exception has been thrown - assertTrue(passed); } /** * Test for writeReplace() method
* ByteArray streams used. - * - * @throws CertificateException - * @throws IOException - * @throws ClassNotFoundException - */ - public final void testSerialization04() - throws CertificateException, - IOException, - ClassNotFoundException { - boolean passed = false; + */ + public final void testWriteReplace() throws Exception + { // Create object to be serialized Certificate c1 = new MyCertificate("DUMMY", null); // This testcase uses ByteArray streams @@ -131,12 +106,10 @@ // Try to serialize cert try { serialize(c1, bos); - } catch (Exception e) { - System.out.println(getName() + ": " + e); - // OSE and NPE are possible - passed = true; + fail("No exception"); + } catch (ObjectStreamException e) { + } catch (NullPointerException e) { } - assertTrue(passed); } // @@ -173,10 +146,8 @@ ClassNotFoundException { // deserialize our object ObjectInputStream ois = new ObjectInputStream(is); - Certificate cert = null; try { - cert = (Certificate)ois.readObject(); - return cert; + return (Certificate)ois.readObject(); } finally { ois.close(); }