@Before
    public void createFixture() throws Exception
    {
        trustStore = KeyStore.getInstance( KeyStore.getDefaultType() );
        trustStore.load( null, null );

        // Add root certificate of a valid chain to the trust store.
        trustStore.setCertificateEntry( getLast( validChain ).getSubjectDN().getName(), getLast( validChain ) );

        // Add root certificate of a chain with an expired intermediate certificate to the trust store.
        trustStore.setCertificateEntry( getLast( expiredIntChain ).getSubjectDN().getName(), getLast( expiredIntChain ) );

        // Add root certificate of a chain with an expired root certificate to the trust store.
        trustStore.setCertificateEntry( getLast( expiredRootChain ).getSubjectDN().getName(), getLast( expiredRootChain ) );

        // Reset the system under test before each test.
        trustManager = new OpenfireX509TrustManager( trustStore, acceptSelfSigned, checkValidity, checkRevocation);
    }
The system under test (refreshed before every test invocation).
xmppserver/src/test/java/org/jivesoftware/openfire/keystore/CheckChainTrustedTest.java