AthenzUtils { public static String getPrincipalName(String domain, String service) { if (domain == null || service == null || domain.isEmpty() || service.isEmpty()) { return null; } return (domain + AuthorityConsts.ATHENZ_PRINCIPAL_DELIMITER + service).toLowerCase(); } private  AthenzUtils(); static String extractServicePrincipal(X509Certificate x509Cert); static boolean isRoleCertificate(X509Certificate x509Cert); static String extractRoleName(final String roleName); static String extractRoleDomainName(final String roleName); static String extractPrincipalDomainName(final String principalName); static String extractPrincipalServiceName(final String principalName); static String[] splitPrincipalName(String name); static String getPrincipalName(String domain, String service); static List<String> splitCommaSeperatedSystemProperty(String property);  }
@Test public void testGetPrincipalName() { assertEquals(AthenzUtils.getPrincipalName("domain", "service"), "domain.service"); assertEquals(AthenzUtils.getPrincipalName("dDd", "SsS"), "ddd.sss"); assertNull(AthenzUtils.getPrincipalName("domain", null)); assertNull(AthenzUtils.getPrincipalName("domain", "")); assertNull(AthenzUtils.getPrincipalName(null, "service")); assertNull(AthenzUtils.getPrincipalName("", "service")); }