ServiceProviderConfig { public RequestingServiceProvider getProviderByEntityID(String entityID) { return allProviders.get(entityID); } ServiceProviderConfig(ConfigHolder configHolder); RequestingServiceProvider getProviderByEntityID(String entityID);  }
@Test void testSingleMetadataFile() throws CertificateException, URISyntaxException, FileNotFoundException { URL metadataDirURL = this.getClass().getResource("/singleMetadataFile"); Mockito.when(mockConfigHolder.getProviderConfigDir()).thenReturn(new File(metadataDirURL.toURI())); URL sigCertURL = this.getClass().getResource("/singleMetadataFile/generated_metadata.crt"); Mockito.when(mockConfigHolder.getMetadataSignatureCert()) .thenReturn(readCertificate(new File(sigCertURL.toURI()))); ServiceProviderConfig config = new ServiceProviderConfig(mockConfigHolder); Assertions.assertNotNull(config.getProviderByEntityID("http: "Metadata expected"); }
@Test void testTwoMetadataFiles() throws CertificateException, URISyntaxException, FileNotFoundException { URL metadataDirURL = this.getClass().getResource("/twoMetadataFiles"); Mockito.when(mockConfigHolder.getProviderConfigDir()).thenReturn(new File(metadataDirURL.toURI())); URL sigCertURL = this.getClass().getResource("/twoMetadataFiles/sigCert.crt"); Mockito.when(mockConfigHolder.getMetadataSignatureCert()) .thenReturn(readCertificate(new File(sigCertURL.toURI()))); ServiceProviderConfig config = new ServiceProviderConfig(mockConfigHolder); Assertions.assertNotNull(config.getProviderByEntityID("https: "First metadata expected"); Assertions.assertNotNull(config.getProviderByEntityID("https: "Second metadata expected"); }