@Test
public void testParseCertificateExcluded() throws Exception {

    Set<String> excludedPrincipalSet = new HashSet<>(Arrays.asList("athenz.syncer", "sports.api"));
    CertificateIdentityParser parser = new CertificateIdentityParser(excludedPrincipalSet, false);
    X509Certificate[] certs = new X509Certificate[]{ this.readCert("valid_cn_x509.cert") };
    CertificateIdentity certId = null;
    try {
        certId = parser.parse(certs);
    } catch (CertificateIdentityException e) {
        assertEquals(e.getMessage(), "Principal is excluded");
    } finally {
        assertNull(certId);
    }
}