@Test( expected = CertPathBuilderException.class )
    public void testFullChainUnrecognizedRoot() throws Exception
    {
        // Setup fixture.
        final X509CertSelector selector = new X509CertSelector();
        selector.setSubject( validChain[0].getSubjectX500Principal() );
        final X509Certificate[] chain = KeystoreTestUtils.generateValidCertificateChain().getCertificateChain();

        // Execute system under test.
        trustManager.checkChainTrusted( selector, chain );

        // Verify results
        // (verified by 'expected' parameter of @Test annotation).
    }
Verifies that providing chain for which the root certificate is not in the store (but is otherwise valid)
throw a CertPathBuilderException.
xmppserver/src/test/java/org/jivesoftware/openfire/keystore/CheckChainTrustedTest.java