@Test
public void testCertificateIdentityParser() {

    BiFunction<Field, CertificateIdentityParser, Object> getFieldValue = (f, object) -> {
        try {
            f.setAccessible(true);
            return f.get(object);
        } catch (IllegalArgumentException | IllegalAccessException e) {
            throw new RuntimeException(e);
        }
    };
    CertificateIdentityParser parser;
    parser = new CertificateIdentityParser(null, false);
    assertNotNull(parser);
    for (Field f : parser.getClass().getDeclaredFields()) {
        switch (f.getName()) {
        case "excludedPrincipalSet":
            assertEquals(getFieldValue.apply(f, parser), null);
            break;
        case "excludeRoleCertificates":
            assertEquals(getFieldValue.apply(f, parser), false);
            break;
        }
    }
    parser = new CertificateIdentityParser(new HashSet<>(Arrays.asList("principal_1", "principal_2")), true);
    assertNotNull(parser);
    for (Field f : parser.getClass().getDeclaredFields()) {
        switch (f.getName()) {
        case "excludedPrincipalSet":
            assertEquals(getFieldValue.apply(f, parser), new HashSet<>(Arrays.asList("principal_1", "principal_2")));
            break;
        case "excludeRoleCertificates":
            assertEquals(getFieldValue.apply(f, parser), true);
            break;
        }
    }
}