CertFileResourcesTrustAnchorsProvider extends CachingTrustAnchorsProviderBase implements InitializingBean { TrustAnchor loadTrustAnchor(Resource certificate) { try { X509Certificate x509Certificate = CertificateUtil.generateX509Certificate(certificate.getInputStream()); return new TrustAnchor(x509Certificate, null); } catch (IOException e) { throw new UncheckedIOException(e); } } CertFileResourcesTrustAnchorsProvider();  CertFileResourcesTrustAnchorsProvider(List<Resource> certificates); @Override void afterPropertiesSet(); List<Resource> getCertificates(); void setCertificates(List<Resource> certificates);  }
@Test(expected = UncheckedIOException.class) public void loadTrustAnchor_test() throws IOException { CertFileResourcesTrustAnchorsProvider trustAnchorProvider = new CertFileResourcesTrustAnchorsProvider(); Resource resource = mock(Resource.class); when(resource.getInputStream()).thenThrow(IOException.class); trustAnchorProvider.loadTrustAnchor(resource); }