@Test
    public void testIgnoreEmptyArraySlots() throws Exception
    {
        // Setup fixture.
        final CertSelector selector = new X509CertSelector();

        // Inject a null value, moving but not removing all other certificates.
        final List<X509Certificate> copy = new ArrayList<>( Arrays.asList( validChain ) ); // wrapping needed to support remove function.
        copy.add( 1, null );
        final X509Certificate[] chain = copy.toArray(new X509Certificate[0]);

        // Execute system under test.
        final CertPath result = trustManager.checkChainTrusted( selector, chain );

        // Verify results
        Assert.assertNotNull( result );
    }
Verifies that null values in the provided chain are silently ignored.
xmppserver/src/test/java/org/jivesoftware/openfire/keystore/CheckChainTrustedTest.java