/** * Loads the contacts settings from the properties file */ private List<Contact> loadContacts() { List<Contact> contacts = new LinkedList<>(); String technicalGn = loadStringProperty(CONTACT_TECHNICAL_GIVEN_NAME); String technicalEmailAddress = loadStringProperty(CONTACT_TECHNICAL_EMAIL_ADDRESS); if ((technicalGn != null && !technicalGn.isEmpty()) || (technicalEmailAddress != null && !technicalEmailAddress.isEmpty())) { Contact technical = new Contact("technical", technicalGn, technicalEmailAddress); contacts.add(technical); } String supportGn = loadStringProperty(CONTACT_SUPPORT_GIVEN_NAME); String supportEmailAddress = loadStringProperty(CONTACT_SUPPORT_EMAIL_ADDRESS); if ((supportGn != null && !supportGn.isEmpty()) || (supportEmailAddress != null && !supportEmailAddress.isEmpty())) { Contact support = new Contact("support", supportGn, supportEmailAddress); contacts.add(support); } return contacts; }
/** * Tests the Contact constructor * * @see com.onelogin.saml2.model.Contact */ @Test public void testContact() { Contact contact = new Contact(null, null, null); assertEquals("", contact.getContactType()); assertEquals("", contact.getGivenName()); assertEquals("", contact.getEmailAddress()); Contact contact2 = new Contact("", "", ""); assertEquals("", contact2.getContactType()); assertEquals("", contact2.getGivenName()); assertEquals("", contact2.getEmailAddress()); Contact contact3 = new Contact("technical", "Name", "mail@example.com"); assertEquals("technical", contact3.getContactType()); assertEquals("Name", contact3.getGivenName()); assertEquals("mail@example.com", contact3.getEmailAddress()); } }