harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r433557 - /incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/SubjectDomainCombinerTest.java
Date Tue, 22 Aug 2006 07:55:12 GMT
Author: smishura
Date: Tue Aug 22 00:55:12 2006
New Revision: 433557

URL: http://svn.apache.org/viewvc?rev=433557&view=rev
Log:
Change assertTrue->assertSame + minor updates

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/SubjectDomainCombinerTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/SubjectDomainCombinerTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/SubjectDomainCombinerTest.java?rev=433557&r1=433556&r2=433557&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/SubjectDomainCombinerTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/SubjectDomainCombinerTest.java
Tue Aug 22 00:55:12 2006
@@ -58,7 +58,7 @@
 
         SubjectDomainCombiner combiner = new SubjectDomainCombiner(subject);
 
-        assertTrue("Subject is not null", subject == combiner.getSubject());
+        assertSame("Subject", subject, combiner.getSubject());
 
         try {
             // Regression for HARMONY-219
@@ -69,7 +69,8 @@
     }
 
     /**
-     * Testing combine(ProtectionDomain[], ProtectionDomain[]) 
+     * @tests javax.security.auth.SubjectDomainCombiner#combine(ProtectionDomain[],
+     *        ProtectionDomain[])
      */
     public final void testCombine() throws Exception {
 
@@ -87,11 +88,10 @@
 
         ProtectionDomain[] pd;
 
-        // both prarameters are null
-        pd = combiner.combine(null, null);
-        assertEquals("Returned protection domain array", null, pd);
+        // test case: both prarameters are null
+        assertNull(combiner.combine(null, null));
 
-        // check assigned principals
+        // test case: check assigned principals
         URL url = new URL("file://foo.txt");
 
         CodeSource source = new CodeSource(url, (Certificate[]) null);
@@ -110,29 +110,25 @@
 
         pd = combiner.combine(new ProtectionDomain[] { domain }, null);
 
-        assertTrue("CodeSource", source == pd[0].getCodeSource());
-        assertTrue("PermissionCollection", permissions == pd[0]
+        assertSame("CodeSource", source, pd[0].getCodeSource());
+        assertSame("PermissionCollection", permissions, pd[0]
                 .getPermissions());
-        assertTrue("ClassLoader", classLoader == pd[0].getClassLoader());
+        assertSame("ClassLoader", classLoader, pd[0].getClassLoader());
 
         assertEquals("Size", 1, pd[0].getPrincipals().length);
-        assertTrue("Principal", principal == (pd[0].getPrincipals())[0]);
+        assertSame("Principal", principal, (pd[0].getPrincipals())[0]);
 
-        // check inherited domains
+        // test case: check inherited domains
         pd = combiner.combine(null, new ProtectionDomain[] { domain });
-        assertTrue("Inherited domain", domain == pd[0]);
+        assertSame("Inherited domain", domain, pd[0]);
     }
 
     public final void testSecurityException() {
 
         denyPermission(new AuthPermission("getSubjectFromDomainCombiner"));
 
-        Subject subject = new Subject();
-
-        SubjectDomainCombiner combiner = new SubjectDomainCombiner(subject);
-
         try {
-            combiner.getSubject();
+            new SubjectDomainCombiner(new Subject()).getSubject();
         } catch (AccessControlException e) {
             assertEquals(e, AuthPermission.class);
         }



Mime
View raw message