@Test void testGetCertificatesWithNullInputStream() { SLException exception = Assertions.assertThrows(SLException.class, () -> mtaCertificateChecker.readCertificates("non-existing-certificate.crt")); Assertions.assertEquals("Missing input stream", exception.getMessage()); }
public List<X509Certificate> readCertificates(String certificatesFilename) { try (InputStream certificatesInputStream = getClass().getResourceAsStream(certificatesFilename)) { CertificateFactory certificateFactory = CertificateFactory.getInstance(Constants.CERTIFICATE_TYPE_X_509); return (List<X509Certificate>) certificateFactory.generateCertificates(certificatesInputStream); } catch (CertificateException | IOException e) { throw new SLException(e, e.getMessage()); } }
JarSignatureOperations { public List<X509Certificate> readCertificates(String certificatesFilename) { try (InputStream certificatesInputStream = getClass().getResourceAsStream(certificatesFilename)) { CertificateFactory certificateFactory = CertificateFactory.getInstance(Constants.CERTIFICATE_TYPE_X_509); return (List<X509Certificate>) certificateFactory.generateCertificates(certificatesInputStream); } catch (CertificateException | IOException e) { throw new SLException(e, e.getMessage()); } } }
JarSignatureOperations { public List<X509Certificate> readCertificates(String certificatesFilename) { try (InputStream certificatesInputStream = getClass().getResourceAsStream(certificatesFilename)) { CertificateFactory certificateFactory = CertificateFactory.getInstance(Constants.CERTIFICATE_TYPE_X_509); return (List<X509Certificate>) certificateFactory.generateCertificates(certificatesInputStream); } catch (CertificateException | IOException e) { throw new SLException(e, e.getMessage()); } }  }
JarSignatureOperations { public List<X509Certificate> readCertificates(String certificatesFilename) { try (InputStream certificatesInputStream = getClass().getResourceAsStream(certificatesFilename)) { CertificateFactory certificateFactory = CertificateFactory.getInstance(Constants.CERTIFICATE_TYPE_X_509); return (List<X509Certificate>) certificateFactory.generateCertificates(certificatesInputStream); } catch (CertificateException | IOException e) { throw new SLException(e, e.getMessage()); } }  void checkCertificates(URL url, List<X509Certificate> certificates, String certificateCN); List<X509Certificate> readCertificates(String certificatesFilename); }
JarSignatureOperations { public List<X509Certificate> readCertificates(String certificatesFilename) { try (InputStream certificatesInputStream = getClass().getResourceAsStream(certificatesFilename)) { CertificateFactory certificateFactory = CertificateFactory.getInstance(Constants.CERTIFICATE_TYPE_X_509); return (List<X509Certificate>) certificateFactory.generateCertificates(certificatesInputStream); } catch (CertificateException | IOException e) { throw new SLException(e, e.getMessage()); } }  void checkCertificates(URL url, List<X509Certificate> certificates, String certificateCN); List<X509Certificate> readCertificates(String certificatesFilename);  }