@@ -166,6 +166,8 @@ public void testLoadFromFileMinProp() throws IOException, CertificateException,
166166
167167 assertNull (setting .getOrganization ());
168168 assertTrue (setting .getContacts ().isEmpty ());
169+
170+ assertEquals ("ONELOGIN_" , setting .getUniqueIDPrefix ());
169171 }
170172
171173 /**
@@ -235,6 +237,8 @@ public void testLoadFromFileAllProp() throws IOException, CertificateException,
235237 assertEquals ("support" , c2 .getContactType ());
236238 assertEquals ("support@example.com" , c2 .getEmailAddress ());
237239 assertEquals ("Support Guy" , c2 .getGivenName ());
240+
241+ assertEquals ("EXAMPLE" , setting .getUniqueIDPrefix ());
238242 }
239243
240244 /**
@@ -522,6 +526,21 @@ public void testLoadFromFileDifferentProp() throws IOException, CertificateExcep
522526 assertTrue (c2 .getGivenName ().isEmpty ());
523527 }
524528
529+ /**
530+ * Tests SettingsBuilder fromFile method
531+ * Case: min settings with minimal Unique ID config file
532+ *
533+ * @throws Exception
534+ *
535+ * @see com.onelogin.saml2.settings.SettingsBuilder#fromFile
536+ */
537+ @ Test
538+ public void testLoadFromFileMinUniqueIDProp () throws Exception {
539+ Saml2Settings setting = new SettingsBuilder ().fromFile ("config/config.min_uniqueid.properties" ).build ();
540+
541+ assertEquals ("_" , setting .getUniqueIDPrefix ());
542+ }
543+
525544 /**
526545 * Tests SettingsBuilder fromProperties method
527546 *
@@ -586,6 +605,8 @@ public void testFromProperties() throws IOException, Error, CertificateException
586605
587606 assertNull (setting2 .getOrganization ());
588607 assertTrue (setting2 .getContacts ().isEmpty ());
608+
609+ assertEquals ("ONELOGIN_" , setting2 .getUniqueIDPrefix ());
589610 }
590611
591612 /**
@@ -654,6 +675,8 @@ public void testLoadFromValues() throws Exception {
654675 samlData .put (CONTACT_TECHNICAL_EMAIL_ADDRESS , "technical@example.org" );
655676 samlData .put (CONTACT_SUPPORT_GIVEN_NAME , "Support Guy" );
656677 samlData .put (CONTACT_SUPPORT_EMAIL_ADDRESS , "support@example.org" );
678+
679+ samlData .put (UNIQUE_ID_PREFIX_PROPERTY_KEY , "_" );
657680
658681 Saml2Settings setting = new SettingsBuilder ().fromValues (samlData ).build ();
659682
@@ -717,6 +740,8 @@ public void testLoadFromValues() throws Exception {
717740 assertEquals ("support" , c2 .getContactType ());
718741 assertEquals ("support@example.org" , c2 .getEmailAddress ());
719742 assertEquals ("Support Guy" , c2 .getGivenName ());
743+
744+ assertEquals ("_" , setting .getUniqueIDPrefix ());
720745 }
721746
722747 /**
@@ -840,6 +865,8 @@ public void testLoadFromValuesWithObjects() throws Exception {
840865 assertEquals ("support" , c2 .getContactType ());
841866 assertEquals ("support@example.org" , c2 .getEmailAddress ());
842867 assertEquals ("Support Guy" , c2 .getGivenName ());
868+
869+ assertEquals ("ONELOGIN_" , setting .getUniqueIDPrefix ());
843870 }
844871
845872 /**
0 commit comments