harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odea...@apache.org
Subject svn commit: r590032 - in /harmony/enhanced/classlib/trunk/modules/x-net/src/test: api/java/org/apache/harmony/xnet/tests/javax/net/ssl/ impl/java/org/apache/harmony/xnet/tests/provider/jsse/
Date Tue, 30 Oct 2007 11:01:54 GMT
Author: odeakin
Date: Tue Oct 30 04:01:50 2007
New Revision: 590032

URL: http://svn.apache.org/viewvc?rev=590032&view=rev
Log:
Let JUnit deal with unexpected Exceptions rather than catching them ourselves - x-net module.

Modified:
    harmony/enhanced/classlib/trunk/modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/KeyManagerFactory1Test.java
    harmony/enhanced/classlib/trunk/modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLSocketTest.java
    harmony/enhanced/classlib/trunk/modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/TrustManagerFactory1Test.java
    harmony/enhanced/classlib/trunk/modules/x-net/src/test/impl/java/org/apache/harmony/xnet/tests/provider/jsse/TrustManagerFactoryImplTest.java

Modified: harmony/enhanced/classlib/trunk/modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/KeyManagerFactory1Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/KeyManagerFactory1Test.java?rev=590032&r1=590031&r2=590032&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/KeyManagerFactory1Test.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/KeyManagerFactory1Test.java
Tue Oct 30 04:01:50 2007
@@ -338,7 +338,7 @@
      * Test for <code>KeyManagerFactory</code> constructor 
      * Assertion: returns KeyManagerFactory object
      */
-    public void testKeyManagerFactory10() throws NoSuchAlgorithmException {
+    public void testKeyManagerFactory10() throws Exception {
         if (!DEFSupported) {
             fail(NotSupportedMsg);
             return;
@@ -354,9 +354,9 @@
             keyMF.init(null, new char[1]);
             fail("UnrecoverableKeyException must be thrown");
         } catch (UnrecoverableKeyException e) {
-        } catch (Exception e) {
-            fail("Unexpected: "+e.toString()+" was thrown");
+            // Expected
         }
+
         keyMF = new myKeyManagerFactory(null, null, null);
         assertTrue("Not CertStore object", keyMF instanceof KeyManagerFactory);
         assertNull("Aalgorithm must be null", keyMF.getAlgorithm());
@@ -372,8 +372,7 @@
      * <code>getKeyManagers()</code> 
      * Assertion: returns not empty KeyManager array
      */
-    public void testKeyManagerFactory11() throws NoSuchAlgorithmException,
-            KeyStoreException, UnrecoverableKeyException {
+    public void testKeyManagerFactory11() throws Exception {
         if (!DEFSupported) {
             fail(NotSupportedMsg);
             return;
@@ -390,16 +389,9 @@
                     (km.length > 0));
         }
         KeyStore ks;
-        try {
-            ks = KeyStore.getInstance(KeyStore.getDefaultType());
-            ks.load(null, null);
-        } catch (KeyStoreException e) {
-            fail(e.toString() + "default KeyStore type is not supported");
-            return;
-        } catch (Exception e) {
-            fail("Unexpected: " + e.toString());
-            return;
-        }
+        ks = KeyStore.getInstance(KeyStore.getDefaultType());
+        ks.load(null, null);
+
         for (int i = 0; i < keyMF.length; i++) {
             try {
                 keyMF[i].init(ks, new char[10]);

Modified: harmony/enhanced/classlib/trunk/modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLSocketTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLSocketTest.java?rev=590032&r1=590031&r2=590032&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLSocketTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLSocketTest.java
Tue Oct 30 04:01:50 2007
@@ -49,36 +49,28 @@
     /*
      * Class under test for void SSLSocket(String, int)
      */
-    public void testSSLSocketStringint() {
-        try {
-            ServerSocket ss = new ServerSocket(0);
-            SSLSocket soc = new MySSLSocket("localhost", ss.getLocalPort());
-            ss.close();
-            soc.close();
-        } catch (Exception e) {
-            fail(e.toString());
-        }
+    public void testSSLSocketStringint() throws Exception {
+        ServerSocket ss = new ServerSocket(0);
+        SSLSocket soc = new MySSLSocket("localhost", ss.getLocalPort());
+        ss.close();
+        soc.close();
     }
 
     /*
      * Class under test for void SSLSocket(InetAddress, int)
      */
-    public void testSSLSocketInetAddressint() {
-        try {
-            ServerSocket ss = new ServerSocket(0);
-            SSLSocket soc = new MySSLSocket(InetAddress.getLocalHost(), ss
-                    .getLocalPort());
-            ss.close();
-            soc.close();
-        } catch (Exception e) {
-            fail(e.toString());
-        }
+    public void testSSLSocketInetAddressint() throws Exception {
+        ServerSocket ss = new ServerSocket(0);
+        SSLSocket soc = new MySSLSocket(InetAddress.getLocalHost(), ss
+                .getLocalPort());
+        ss.close();
+        soc.close();
     }
 
     /*
      * Class under test for void SSLSocket(String, int, InetAddress, int)
      */
-    public void testSSLSocketStringintInetAddressint() {
+    public void testSSLSocketStringintInetAddressint() throws Exception {
         try {
             ServerSocket ss1 = new ServerSocket(0);
             ServerSocket ss2 = new ServerSocket(0);
@@ -88,15 +80,13 @@
             ss2.close();
             soc.close();
         } catch (IOException e) {
-        } catch (Exception e) {
-            fail(e.toString());
         }
     }
 
     /*
      * Class under test for void SSLSocket(InetAddress, int, InetAddress, int)
      */
-    public void testSSLSocketInetAddressintInetAddressint() {
+    public void testSSLSocketInetAddressintInetAddressint() throws Exception {
         try {
             ServerSocket ss1 = new ServerSocket(0);
             ServerSocket ss2 = new ServerSocket(0);
@@ -107,8 +97,6 @@
             ss2.close();
             soc.close();
         } catch (IOException e) {
-        } catch (Exception e) {
-            fail(e.toString());
         }
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/TrustManagerFactory1Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/TrustManagerFactory1Test.java?rev=590032&r1=590031&r2=590032&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/TrustManagerFactory1Test.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/TrustManagerFactory1Test.java
Tue Oct 30 04:01:50 2007
@@ -372,24 +372,16 @@
      * <code>getTrustManagers()</code>
      * Assertion: returns not empty TrustManager array
      */
-    public void testTrustManagerFactory11() throws NoSuchAlgorithmException,
-            KeyStoreException {
+    public void testTrustManagerFactory11() throws Exception {
         if (!DEFSupported) {
             fail(NotSupportedMsg);
             return;
         }
         KeyStore ks;
         KeyStore ksNull = null;
-        try {
-            ks = KeyStore.getInstance(KeyStore.getDefaultType());
-            ks.load(null, null);            
-        } catch (KeyStoreException e) {
-            fail(e.toString() + "default KeyStore type is not supported");
-            return;
-        } catch (Exception e) {
-            fail("Unexpected: " + e.toString());
-            return;
-        }
+        ks = KeyStore.getInstance(KeyStore.getDefaultType());
+        ks.load(null, null);            
+ 
         TrustManager[] tm;
         TrustManagerFactory[] trustMF = createTMFac();
         assertNotNull("TrustManagerFactory objects were not created", trustMF);

Modified: harmony/enhanced/classlib/trunk/modules/x-net/src/test/impl/java/org/apache/harmony/xnet/tests/provider/jsse/TrustManagerFactoryImplTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/x-net/src/test/impl/java/org/apache/harmony/xnet/tests/provider/jsse/TrustManagerFactoryImplTest.java?rev=590032&r1=590031&r2=590032&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/x-net/src/test/impl/java/org/apache/harmony/xnet/tests/provider/jsse/TrustManagerFactoryImplTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/x-net/src/test/impl/java/org/apache/harmony/xnet/tests/provider/jsse/TrustManagerFactoryImplTest.java
Tue Oct 30 04:01:50 2007
@@ -69,7 +69,7 @@
         }
     }
 
-    public void testEngineGetTrustManagers() {
+    public void testEngineGetTrustManagers() throws Exception {
         TrustManagerFactoryImpl tmf = new TrustManagerFactoryImpl();
         try {
             tmf.engineGetTrustManagers();
@@ -78,13 +78,10 @@
             // expected
         }
         KeyStore ks;
-        try {
-            ks = KeyStore.getInstance("BKS");
-            ks.load(null, null);
-            tmf.engineInit(ks);
-        } catch (Exception e) {
-            fail(e.toString());
-        }
+        ks = KeyStore.getInstance("BKS");
+        ks.load(null, null);
+        tmf.engineInit(ks);
+
         TrustManager[] tma = tmf.engineGetTrustManagers();
         assertEquals("Incorrect array length", 1, tma.length);
         assertTrue("Incorrect KeyManager type",



Mime
View raw message