You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by hi...@apache.org on 2007/05/21 22:31:21 UTC

svn commit: r540266 [2/2] - in /harmony/enhanced/classlib/trunk/modules/x-net/src/test: api/java/org/apache/harmony/xnet/tests/javax/net/ssl/ impl/java.injected/org/apache/harmony/xnet/provider/jsse/ impl/java/org/apache/harmony/xnet/tests/provider/jss...

Modified: harmony/enhanced/classlib/trunk/modules/x-net/src/test/impl/java/org/apache/harmony/xnet/tests/provider/jsse/ProtocolVersionTest.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/ProtocolVersionTest.java?view=diff&rev=540266&r1=540265&r2=540266
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/x-net/src/test/impl/java/org/apache/harmony/xnet/tests/provider/jsse/ProtocolVersionTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/x-net/src/test/impl/java/org/apache/harmony/xnet/tests/provider/jsse/ProtocolVersionTest.java Mon May 21 13:31:19 2007
@@ -46,11 +46,11 @@
     }
 
     public void testGetByVersion() {
-        assertEquals(ProtocolVersion.getByVersion(new byte[] { 2, 1 }), null);
-        assertEquals(ProtocolVersion.getByVersion(new byte[] { 3, 0 }).name,
-                "SSLv3");
-        assertEquals(ProtocolVersion.getByVersion(new byte[] { 3, 1 }).name,
-                "TLSv1");
+        assertNull(ProtocolVersion.getByVersion(new byte[] { 2, 1 }));
+        assertEquals("SSLv3",
+                     ProtocolVersion.getByVersion(new byte[] { 3, 0 }).name);
+        assertEquals("TLSv1",
+                     ProtocolVersion.getByVersion(new byte[] { 3, 1 }).name);
     }
 
     /*
@@ -65,21 +65,19 @@
     }
 
     public void testGetByName() {
-        assertEquals(ProtocolVersion.getByName("SSLv2"), null);
-        assertEquals(ProtocolVersion.getByName("SSLv3").name, "SSLv3");
-        assertEquals(ProtocolVersion.getByName("TLSv1").name, "TLSv1");
+        assertNull(ProtocolVersion.getByName("SSLv2"));
+        assertEquals("SSLv3", ProtocolVersion.getByName("SSLv3").name);
+        assertEquals("TLSv1", ProtocolVersion.getByName("TLSv1").name);
     }
 
     public void testGetLatestVersion() {
         ProtocolVersion ver = ProtocolVersion.getLatestVersion(new String[] {
                 "SSLv2", "TLSv1", "SSLv3" });
-        assertTrue("Incorrect protocol version " + ver.name, ver.name
-                .equals("TLSv1"));
+        assertEquals("Incorrect protocol version", "TLSv1", ver.name);
 
         ver = ProtocolVersion.getLatestVersion(new String[] {"SSLv3",
                 "unknown", "SSLv2" });
-        assertEquals("Incorrect protocol version " + ver.name, ver.name,
-                "SSLv3");
+        assertEquals("Incorrect protocol version", "SSLv3", ver.name);
     }
 
 }

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?view=diff&rev=540266&r1=540265&r2=540266
==============================================================================
--- 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 Mon May 21 13:31:19 2007
@@ -86,7 +86,7 @@
             fail(e.toString());
         }
         TrustManager[] tma = tmf.engineGetTrustManagers();
-        assertTrue("Incorrect array length", tma.length == 1);
+        assertEquals("Incorrect array length", 1, tma.length);
         assertTrue("Incorrect KeyManager type",
                 tma[0] instanceof TrustManagerImpl);
     }

Modified: harmony/enhanced/classlib/trunk/modules/x-net/src/test/java/javax/net/ssl/KeyManagerFactorySpiTests.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/x-net/src/test/java/javax/net/ssl/KeyManagerFactorySpiTests.java?view=diff&rev=540266&r1=540265&r2=540266
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/x-net/src/test/java/javax/net/ssl/KeyManagerFactorySpiTests.java (original)
+++ harmony/enhanced/classlib/trunk/modules/x-net/src/test/java/javax/net/ssl/KeyManagerFactorySpiTests.java Mon May 21 13:31:19 2007
@@ -52,7 +52,8 @@
      * Test for <code>KeyManagerFactorySpi</code> constructor 
      * Assertion: constructs KeyManagerFactorySpi
      */
-    public void testKeyManagerFactorySpi01() {
+    public void testKeyManagerFactorySpi01()
+            throws Exception {
         KeyManagerFactorySpi kmfSpi = new MyKeyManagerFactorySpi();
         assertNull(kmfSpi.engineGetKeyManagers());
         KeyStore kStore = null;
@@ -64,15 +65,11 @@
             kmfSpi.engineInit(kStore, null);
             fail("KeyStoreException must be thrown");
         } catch (KeyStoreException e) {
-        } catch (Exception e) {
-            fail("Unexpected: ".concat(e.toString()));
         }
         try {
             kmfSpi.engineInit(kStore, pass);
             fail("UnrecoverableKeyException must be thrown");
         } catch (UnrecoverableKeyException e) {
-        } catch (Exception e) {
-            fail("Unexpected: ".concat(e.toString()));
         }
         try {
             kmfSpi.engineInit(mfp);
@@ -88,15 +85,9 @@
         } catch (KeyStoreException e) {
             fail("default keystore type is not supported");
             return;
-        } catch (Exception e) {
-            fail("Unexpected: "+e.toString());
-            return;            
-        }
-        try {
-            kmfSpi.engineInit(kStore, pass);
-        } catch (Exception e) {
-            fail("Unexpected: ".concat(e.toString()));
         }
+        kmfSpi.engineInit(kStore, pass);
+
         mfp = new MyKeyManagerFactorySpi.Parameters(kStore, null);
         try {
             kmfSpi.engineInit(mfp);
@@ -104,11 +95,7 @@
         } catch (InvalidAlgorithmParameterException e) {
         }
         mfp = new MyKeyManagerFactorySpi.Parameters(kStore, pass);
-        try {
-            kmfSpi.engineInit(mfp);
-        } catch (InvalidAlgorithmParameterException e) {
-            fail("Unexpected InvalidAlgorithmParameterException was thrown");
-        }
+        kmfSpi.engineInit(mfp);
     }
 }
 

Modified: harmony/enhanced/classlib/trunk/modules/x-net/src/test/java/javax/net/ssl/SSLContextSpiTests.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/x-net/src/test/java/javax/net/ssl/SSLContextSpiTests.java?view=diff&rev=540266&r1=540265&r2=540266
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/x-net/src/test/java/javax/net/ssl/SSLContextSpiTests.java (original)
+++ harmony/enhanced/classlib/trunk/modules/x-net/src/test/java/javax/net/ssl/SSLContextSpiTests.java Mon May 21 13:31:19 2007
@@ -55,37 +55,37 @@
             sslConSpi.engineGetSocketFactory();
             fail("RuntimeException must be thrown");
         } catch (RuntimeException e) {
-            assertEquals("Incorrect message", e.getMessage(),"Not initialiazed");
+            assertEquals("Incorrect message", "Not initialiazed", e.getMessage());
         }
         try {
             sslConSpi.engineGetServerSocketFactory();
             fail("RuntimeException must be thrown");
         } catch (RuntimeException e) {
-            assertEquals("Incorrect message", e.getMessage(),"Not initialiazed");
+            assertEquals("Incorrect message", "Not initialiazed", e.getMessage());
         }
         try {
             sslConSpi.engineGetServerSessionContext();
             fail("RuntimeException must be thrown");
         } catch (RuntimeException e) {
-            assertEquals("Incorrect message", e.getMessage(),"Not initialiazed");
+            assertEquals("Incorrect message", "Not initialiazed", e.getMessage());
         }
         try {
             sslConSpi.engineGetClientSessionContext();
             fail("RuntimeException must be thrown");
         } catch (RuntimeException e) {
-            assertEquals("Incorrect message", e.getMessage(),"Not initialiazed");
+            assertEquals("Incorrect message", "Not initialiazed", e.getMessage());
         }       
         try {
             sslConSpi.engineCreateSSLEngine();
             fail("RuntimeException must be thrown");
         } catch (RuntimeException e) {
-            assertEquals("Incorrect message", e.getMessage(),"Not initialiazed");
+            assertEquals("Incorrect message", "Not initialiazed", e.getMessage());
         }
         try {
             sslConSpi.engineCreateSSLEngine("host",1);
             fail("RuntimeException must be thrown");
         } catch (RuntimeException e) {
-            assertEquals("Incorrect message", e.getMessage(),"Not initialiazed");
+            assertEquals("Incorrect message", "Not initialiazed", e.getMessage());
         }
         sslConSpi.engineInit(null, null, new SecureRandom());
         assertNull("Not null result", sslConSpi.engineGetSocketFactory());

Modified: harmony/enhanced/classlib/trunk/modules/x-net/src/test/java/javax/net/ssl/TrustManagerFactorySpiTests.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/x-net/src/test/java/javax/net/ssl/TrustManagerFactorySpiTests.java?view=diff&rev=540266&r1=540265&r2=540266
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/x-net/src/test/java/javax/net/ssl/TrustManagerFactorySpiTests.java (original)
+++ harmony/enhanced/classlib/trunk/modules/x-net/src/test/java/javax/net/ssl/TrustManagerFactorySpiTests.java Mon May 21 13:31:19 2007
@@ -50,7 +50,7 @@
      * Test for <code>TrustManagerFactorySpi</code> constructor 
      * Assertion: constructs TrustManagerFactorySpi
      */
-    public void testTrustManagerFactorySpi01() throws InvalidAlgorithmParameterException {
+    public void testTrustManagerFactorySpi01() throws Exception {
         TrustManagerFactorySpi kmfSpi = new MyTrustManagerFactorySpi();        
         assertNull("Not null results", kmfSpi.engineGetTrustManagers());
         KeyStore kStore = null;
@@ -75,23 +75,14 @@
         } catch (KeyStoreException e) {
             fail("default keystore is not supported");
             return;
-        } catch (Exception e) {
-            fail("Unexpected: "+e.toString());
-            return;            
-        }
-        try {
-            kmfSpi.engineInit(kStore);
-        } catch (KeyStoreException e) {
-            fail("Unexpected KeyStoreException was thrown");            
         }
+        kmfSpi.engineInit(kStore);
         mfp = new MyTrustManagerFactorySpi.Parameters(null);
         try {
             kmfSpi.engineInit(mfp);
             fail("RuntimeException must be thrown");
         } catch (RuntimeException e) {
             assertTrue("Incorrect exception", e.getCause() instanceof KeyStoreException);
-        } catch (InvalidAlgorithmParameterException e) {
-            fail("Unexpected: ".concat(e.toString()));
         }
         mfp = new MyTrustManagerFactorySpi.Parameters(kStore);
         kmfSpi.engineInit(mfp);