@Test
void testWrongIssuer() throws URISyntaxException
{

  RequestHandler requestHandler = new RequestHandler(mockSessionStore, mockConfigHolder,
                                                     mockServiceProviderConfig);
  File keystoreFile = new File(RequestHandlerTest.class.getResource("/de/governikus/eumw/eidasmiddleware/bos-test-tctoken.saml-sign.p12")
                                                       .toURI());
  KeyStore keyStore = KeyStoreSupporter.readKeyStore(keystoreFile, DEFAULT_PASSWORD);
  String wrongIssuer = "http://wronghost:8080/eIDASDemoApplication/Metadata";
  String request = createSAMLRequest(keyStore,
                                     DEFAULT_PASSWORD,
                                     "bos-test-tctoken.saml-sign",
                                     wrongIssuer,
                                     "http://localhost:8080/eIDASDemoApplication/NewReceiverServlet");
  RequestProcessingException requestProcessingException = Assertions.assertThrows(RequestProcessingException.class,
                                                                                  () -> requestHandler.handleSAMLRequest(RELAY_STATE,
                                                                                                                         request,
                                                                                                                         false));
  Assertions.assertEquals(ErrorCodeException.class,
                          requestProcessingException.getCause().getClass(),
                          "ErrorCodeException expected as cause");
  Assertions.assertEquals(RequestHandler.CANNOT_PARSE_SAML_REQUEST,
                          requestProcessingException.getMessage());
}