@BeforeEach
    public void createFixture() throws Exception
    {
        // Create a fresh store in a location that holds only temporary files.
        final String tempDir = System.getProperty("java.io.tmpdir");
        location = tempDir + ( tempDir.endsWith( File.separator ) ? "" : File.separator ) + UUID.randomUUID();

        trustStore = KeyStore.getInstance( KeyStore.getDefaultType());
        final String password = "TS%WV@# aSG 4";
        trustStore.load( null, password.toCharArray() );

        trustStore.setCertificateEntry( getLast( validChain       ).getSubjectDN().getName(), getLast( validChain       ) );
        trustStore.setCertificateEntry( getLast( expiredIntChain  ).getSubjectDN().getName(), getLast( expiredIntChain  ) );
        trustStore.setCertificateEntry( getLast( expiredRootChain ).getSubjectDN().getName(), getLast( expiredRootChain ) );

        // Persist the key store file
        try ( FileOutputStream fos = new FileOutputStream( location ) ) {
            trustStore.store( fos, password.toCharArray() );
        }

        // Create the Trust Manager that is subject of these tests.
        systemUnderTest = new OpenfireX509TrustManager( trustStore, false, true, false);
    }
The keystore that contains the certificates used by the system under test (refreshed before every test invocation).
xmppserver/src/test/java/org/jivesoftware/openfire/keystore/OpenfireX509TrustManagerTest.java