@Test
    void verifyCert() throws Throwable {
        val tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
        tmf.init((KeyStore) null);

        val managers = Arrays.stream(tmf.getTrustManagers())
            .filter(X509TrustManager.class::isInstance)
            .map(X509TrustManager.class::cast)
            .collect(Collectors.toList());

        val mgr = new CompositeX509TrustManager(managers);
        val certs = new X509Certificate[]{CertUtils.readCertificate(new ClassPathResource("x509.crt").getInputStream())};
        assertThrows(CertificateException.class, () -> mgr.checkClientTrusted(certs, "RSA"));
        assertThrows(CertificateException.class, () -> mgr.checkServerTrusted(certs, "RSA"));
    }
This is {@link CompositeX509TrustManagerTests}.

@author Misagh Moayyed
@since 6.2.0
core/cas-server-core-util-api/src/test/java/org/apereo/cas/util/ssl/CompositeX509TrustManagerTests.java