### Question:
AthenzUtils { public static String extractPrincipalServiceName(final String principalName) { int idx = principalName.lastIndexOf(AuthorityConsts.ATHENZ_PRINCIPAL_DELIMITER_CHAR); if (idx == -1 || idx == 0 || idx == principalName.length() - 1) { return null; } else { return principalName.substring(idx + 1); } } 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);  }### Answer:
@Test public void testExtractPrincipalServiceName() { assertEquals(AthenzUtils.extractPrincipalServiceName("athenz.reader"), "reader"); assertEquals(AthenzUtils.extractPrincipalServiceName("athenz.api.reader"), "reader"); assertEquals(AthenzUtils.extractPrincipalServiceName("athenz.api.test.reader"), "reader"); assertNull(AthenzUtils.extractPrincipalServiceName("athenz")); assertNull(AthenzUtils.extractPrincipalServiceName("athenz.")); assertNull(AthenzUtils.extractPrincipalServiceName(".athenz")); }