### Question:
IdpMetadataPublicKeyStore implements SigningKeyStore { @Override public List<PublicKey> getVerifyingKeysForEntity(String entityId) { Optional<EntityDescriptor> entityDescriptor = getEntityDescriptor(entityId); if (entityDescriptor.isPresent()) { final List<PublicKey> publicKeys = getPublicKeys(entityDescriptor.get(), UsageType.SIGNING); if (!publicKeys.isEmpty()) { return publicKeys; } } throw new NoKeyConfiguredForEntityException(entityId); } @Inject  IdpMetadataPublicKeyStore(MetadataResolver metadataResolver); @Override List<PublicKey> getVerifyingKeysForEntity(String entityId);  }### Answer:
@Test public void shouldReturnTheSigningKeysForAnEntity() throws Exception { IdpMetadataPublicKeyStore idpMetadataPublicKeyStore = new IdpMetadataPublicKeyStore(metadataResolver); PublicKey expectedPublicKey = getX509Key(TestCertificateStrings.STUB_IDP_PUBLIC_PRIMARY_CERT); assertThat(idpMetadataPublicKeyStore.getVerifyingKeysForEntity(TestEntityIds.STUB_IDP_ONE)).containsExactly(expectedPublicKey); }
@Test(expected = NoKeyConfiguredForEntityException.class) public void shouldRaiseAnExceptionWhenThereIsNoEntityDescriptor() throws Exception { IdpMetadataPublicKeyStore idpMetadataPublicKeyStore = new IdpMetadataPublicKeyStore(metadataResolver); idpMetadataPublicKeyStore.getVerifyingKeysForEntity("my-invented-entity-id"); }
@Test(expected = NoKeyConfiguredForEntityException.class) public void shouldRaiseAnExceptionWhenAttemptingToRetrieveAnSPSSOFromMetadata() throws Exception { IdpMetadataPublicKeyStore idpMetadataPublicKeyStore = new IdpMetadataPublicKeyStore(metadataResolver); idpMetadataPublicKeyStore.getVerifyingKeysForEntity("https: }