@Test
public void testExtractServicePrincipal() throws Exception {

    try (InputStream inStream = new FileInputStream("src/test/resources/x509_altnames_singleip.cert")) {
        CertificateFactory cf = CertificateFactory.getInstance("X.509");
        X509Certificate cert = (X509Certificate) cf.generateCertificate(inStream);
        assertEquals("athenz.production", AthenzUtils.extractServicePrincipal(cert));
    }
    try (InputStream inStream = new FileInputStream("src/test/resources/ec_public_x509.cert")) {
        CertificateFactory cf = CertificateFactory.getInstance("X.509");
        X509Certificate cert = (X509Certificate) cf.generateCertificate(inStream);
        assertEquals("athenz.syncer", AthenzUtils.extractServicePrincipal(cert));
    }
}