CertificateUtil { public static PKIXParameters createPKIXParameters(Set<TrustAnchor> trustAnchors) { AssertUtil.notEmpty(trustAnchors, "trustAnchors is required; it must not be empty"); try { return new PKIXParameters(trustAnchors); } catch (InvalidAlgorithmParameterException e) { throw new UnexpectedCheckedException(e); } } private  CertificateUtil(); static CertPathValidator createCertPathValidator(); static PKIXParameters createPKIXParameters(Set<TrustAnchor> trustAnchors); static KeyStore createKeyStore(); static Set<TrustAnchor> generateTrustAnchors(List<C> certificates); static CertPath generateCertPath(List<C> certificates); static X509Certificate generateX509Certificate(byte[] bytes); static X509Certificate generateX509Certificate(InputStream inputStream);  }
@Test void createPKIXParameters_test() { HashSet<TrustAnchor> trustAnchors = new HashSet<>(); trustAnchors.add(new TrustAnchor(mock(X509Certificate.class), null)); PKIXParameters pkixParameters = CertificateUtil.createPKIXParameters(trustAnchors); assertThat(pkixParameters).isNotNull(); }
@Test void createPKIXParameters_test_with_empty_trustAnchors() { HashSet<TrustAnchor> trustAnchors = new HashSet<>(); Throwable t = assertThrows(IllegalArgumentException.class, () -> CertificateUtil.createPKIXParameters(trustAnchors) ); assertThat(t).hasMessage("trustAnchors is required; it must not be empty"); }