@Test
void validateMetadataSignature() throws Exception
{

  EidasMetadataService metadataService = getEidasMetadataService();
  EidasSigner signer = new EidasSigner(keyPair.getKey(), keyPair.getCert());
  byte[] metadataByteArray = metadataService.generate(signer);
  EntityDescriptor metadata = getEntityDescriptor(metadataByteArray);
  SAMLSignatureProfileValidator samlSignatureProfileValidator = new SAMLSignatureProfileValidator();
  samlSignatureProfileValidator.validate(metadata.getSignature());
  Credential credential = new BasicX509Credential(keyPair.getCert());
  SignatureValidator.validate(metadata.getSignature(), credential);
}