harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r504795 - in /harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security: Security2Test.java SecurityTest.java
Date Thu, 08 Feb 2007 05:43:43 GMT
Author: smishura
Date: Wed Feb  7 21:43:42 2007
New Revision: 504795

URL: http://svn.apache.org/viewvc?view=rev&rev=504795
Log:
Merge tests for java.security.Security#getProvider(String)

Modified:
    harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/Security2Test.java
    harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SecurityTest.java

Modified: harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/Security2Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/Security2Test.java?view=diff&rev=504795&r1=504794&r2=504795
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/Security2Test.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/Security2Test.java
Wed Feb  7 21:43:42 2007
@@ -129,28 +129,6 @@
 	}
 
 	/**
-	 * @tests java.security.Security#getProvider(java.lang.String)
-	 */
-	public void test_getProviderLjava_lang_String() {
-		// Test for method java.security.Provider
-		// java.security.Security.getProvider(java.lang.String)
-		Provider[] providers = Security.getProviders();
-		assertNotNull("getProviders returned null", providers);
-		assertTrue("getProviders returned zero length array",
-				providers.length > 0);
-		for (int i = 0; i < providers.length; i++) {
-			Provider provider = providers[i];
-			String providerName = provider.getName();
-			assertTrue("Getting provider " + providerName + " was not "
-					+ "successful even though it is already added", Security
-					.getProvider(providerName).getName().equals(providerName));
-		}// end for
-
-		// exception case
-		assertNull(Security.getProvider("IDontExist"));
-	}
-
-	/**
 	 * @tests java.security.Security#getProviders(java.lang.String)
 	 */
 	public void test_getProvidersLjava_lang_String() {

Modified: harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SecurityTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SecurityTest.java?view=diff&rev=504795&r1=504794&r2=504795
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SecurityTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SecurityTest.java
Wed Feb  7 21:43:42 2007
@@ -166,26 +166,32 @@
         }
     }
 
-    /*
-     * Class under test for Provider getProvider(String)
+    /**
+     * @tests java.security.Security#getProvider(String)
      */
-    public final void testGetProvider() {
+    public final void test_getProviderLjava_lang_String() {
+
+        // Returns null if no provider with the specified name is installed 
+        assertNull(Security.getProvider("SOMEINCORRECTPROVIDERNAME"));
+
+        // Returns null if name is null
+        assertNull(Security.getProvider(null));
+
+        // test for existing providers
+        Provider[] providers = Security.getProviders();
+        assertTrue("getProviders returned zero length array",
+                providers.length > 0);
+        for (Provider p : providers) {
+            String providerName = p.getName();
+            assertSame(p, Security.getProvider(providerName));
+        }
+
+        // test for newly installed provider
         Provider p = new MyProvider();
-        Provider p1;
-        
         try {
             Security.addProvider(p);
-            
-            p1 = Security.getProvider(p.getName());
-            assertSame(p, p1);
-        
-            // Returns null if no provider with the specified name is installed 
-            p1 = Security.getProvider("SOMEINCORRECTPROVIDERNAME");
-            assertNull(p1);
-        
-            // Returns null if name is null
-            p1 = Security.getProvider(null);
-            assertNull(p1);
+
+            assertSame(p, Security.getProvider(p.getName()));
         } finally { //clean up
             Security.removeProvider(p.getName());
         }



Mime
View raw message