### Question:
X509CommonNameUserMapper extends X509AbstractMapper { public LdapName getLdapName(String dn) { try { return new LdapName(dn); } catch (InvalidNameException e) { throw new AuthenticationServiceException("Not able to create ldap name from certificate. Cause: " + e.getMessage(), e); } }  String mapCertificateToMainframeUserId(X509Certificate certificate); LdapName getLdapName(String dn);  }### Answer:
@Test void whenWrongDN_exceptionIsThrown() { Exception exception = assertThrows(AuthenticationServiceException.class, () -> { x509CommonNameUserMapper.getLdapName("wrong DN"); }); assertEquals("Not able to create ldap name from certificate. Cause: Invalid name: wrong DN", exception.getMessage()); }