@Test
public void grantX509RoleTest() throws OadrSecurityException {

	X509Certificate cert = OadrPKISecurity.parseCertificate("src/test/resources/cert/test.crt");
	String fingerprint = OadrFingerprintSecurity.getOadr20bFingerprint(cert);
	User grantX509Role = oadrSecurityRoleService.grantX509Role(fingerprint);
	List<GrantedAuthority> authorities = new ArrayList<>(grantX509Role.getAuthorities());
	assertEquals(1, authorities.size());
	assertEquals("ROLE_VEN", authorities.get(0).getAuthority());
	venX509.setRegistrationId("registrationId");
	venService.save(venX509);
	grantX509Role = oadrSecurityRoleService.grantX509Role(fingerprint);
	authorities = new ArrayList<>(grantX509Role.getAuthorities());
	assertEquals(2, authorities.size());
	assertTrue(authorities.get(1).getAuthority().equals("ROLE_VEN")
			|| authorities.get(1).getAuthority().equals("ROLE_REGISTERED"));
	assertTrue(authorities.get(0).getAuthority().equals("ROLE_VEN")
			|| authorities.get(0).getAuthority().equals("ROLE_REGISTERED"));
	grantX509Role = oadrSecurityRoleService.grantX509Role(vtnConfig.getOadr20bFingerprint());
	authorities = new ArrayList<>(grantX509Role.getAuthorities());
	assertEquals(1, authorities.size());
	assertEquals("ROLE_VTN", authorities.get(0).getAuthority());
	boolean exception = false;
	try {
		oadrSecurityRoleService.grantX509Role("mouaiccool");
	} catch (Exception e) {
		exception = true;
	}
	assertTrue(exception);
}