@Test
    public void testInvalidChainMissingIntermediate() throws Exception
    {
        // Setup fixture.
        assert validChain.length == 4;
        final X509Certificate[] input = new X509Certificate[ 3 ];
        input[ 0 ] = validChain[ 0 ];
        input[ 1 ] = validChain[ 2 ];
        input[ 2 ] = validChain[ 3 ];

        // Execute system under test.
        assertThrows(CertificateException.class, () -> systemUnderTest.checkClientTrusted( input, "RSA" ) );
    }
Verifies that a chain that is missing an intermediate certificate is rejected.
xmppserver/src/test/java/org/jivesoftware/openfire/keystore/OpenfireX509TrustManagerTest.java