@Test
public void testCertificateIdentity() throws Exception {

    X509Certificate cert = this.readCert("valid_cn_x509.cert");
    CertificateIdentity certId = new CertificateIdentity("domain", "service", Arrays.asList("role_1", "role_2"), cert);
    assertNotNull(certId);
    assertEquals(certId.getDomain(), "domain");
    assertEquals(certId.getService(), "service");
    assertEquals(certId.getRoles(), Arrays.asList("role_1", "role_2"));
    assertSame(certId.getX509Certificate(), cert);
}