harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r482590 - /harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SignerTest.java
Date Tue, 05 Dec 2006 11:03:21 GMT
Author: smishura
Date: Tue Dec  5 03:03:18 2006
New Revision: 482590

URL: http://svn.apache.org/viewvc?view=rev&rev=482590
Log:
Refactoring test for java.security.Signer.setKeyPair(java.security.KeyPair)

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

Modified: harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SignerTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SignerTest.java?view=diff&rev=482590&r1=482589&r2=482590
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SignerTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SignerTest.java
Tue Dec  5 03:03:18 2006
@@ -143,20 +143,25 @@
     }
 
     /**
-     * verify Signer.setkeyPair() throws SecurityException if permission is denied
+     * @tests java.security.Signer#setKeyPair(java.security.KeyPair) 
      */
-    public void testSetKeyPair_denied() throws Exception {
+    public void test_setKeyPairLjava_security_KeyPair() throws Exception {
+        
+        // test: SecurityException if permission is denied
+        SecurityManager oldSm = System.getSecurityManager();
         MySecurityManager sm = new MySecurityManager();
         sm.denied.add(new SecurityPermission("setSignerKeyPair"));
         System.setSecurityManager(sm);
         try {
-            Signer s = new SignerStub("sss7");            
+            Signer s = new SignerStub("sss7");
             try {
-                s.setKeyPair(new KeyPair(new PublicKeyStub("public", "fff", null), new PrivateKeyStub("private",
"fff", null)));
+                s.setKeyPair(new KeyPair(new PublicKeyStub("public", "fff",
+                        null), new PrivateKeyStub("private", "fff", null)));
                 fail("SecurityException should be thrown");
-            } catch (SecurityException ok) {}            
+            } catch (SecurityException ok) {
+            }
         } finally {
-            System.setSecurityManager(null);
+            System.setSecurityManager(oldSm);
         }        
     }
 



Mime
View raw message