[java-identity-provider] branch main updated: Add a test for equality override.

Scott Cantor cantor.2 at osu.edu
Thu Apr 15 13:38:37 UTC 2021


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch main
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=6c26030a7c658ff401bacaff1f5497aa3cc9ddf7

The following commit(s) were added to refs/heads/main by this push:
       new  6c26030a7 Add a test for equality override.
6c26030a7 is described below

commit 6c26030a7c658ff401bacaff1f5497aa3cc9ddf7
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Apr 15 09:38:34 2021 -0400

    Add a test for equality override.
---
 .../idp/authn/principal/UsernamePrincipalTest.java         | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/idp-authn-api/src/test/java/net/shibboleth/idp/authn/principal/UsernamePrincipalTest.java b/idp-authn-api/src/test/java/net/shibboleth/idp/authn/principal/UsernamePrincipalTest.java
index a7235b952..9cf326aa9 100644
--- a/idp-authn-api/src/test/java/net/shibboleth/idp/authn/principal/UsernamePrincipalTest.java
+++ b/idp-authn-api/src/test/java/net/shibboleth/idp/authn/principal/UsernamePrincipalTest.java
@@ -19,6 +19,8 @@ package net.shibboleth.idp.authn.principal;
 
 import net.shibboleth.utilities.java.support.logic.ConstraintViolationException;
 
+import javax.security.auth.Subject;
+
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
@@ -52,4 +54,16 @@ public class UsernamePrincipalTest {
         }
     }
     
+    /** Tests that equality is working correctly. */
+    @Test public void testSubjectBehavior() {
+        final Subject subject = new Subject();
+        Assert.assertTrue(subject.getPrincipals(UsernamePrincipal.class).isEmpty());
+        
+        subject.getPrincipals().add(new UsernamePrincipal("jdoe"));
+        Assert.assertEquals(subject.getPrincipals(UsernamePrincipal.class).size(), 1);
+
+        subject.getPrincipals().add(new UsernamePrincipal("jdoe"));
+        Assert.assertEquals(subject.getPrincipals(UsernamePrincipal.class).size(), 1);
+    }
+    
 }
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list