@Test
public void testLoadPassword() throws CertificateException, NoSuchAlgorithmException, IOException, KeyStoreException, InvalidKeyException, InvalidKeySpecException {

    final SecretKey storedSecretKey = storeKeyIntoKeyStoreFile(KEY_PHRASE);
    // Set properties to simulate the server
    final URL serverKeyStoreURL = getClass().getResource(KEYSTORE_JCEKS_RESOURCE_NAME);
    System.setProperty(KeyStoreConstants.PROP_PWD_KS_URL, serverKeyStoreURL.toExternalForm());
    System.setProperty(KeyStoreConstants.PROP_PWD_KS_PWD, KEYSTORE_SERVER_PASSWORD);
    try {
        final KeyStoreHelper serverHelper = new KeyStoreHelper();
        final String passwordKey = serverHelper.getPasswordKey(KEY_ALIAS, KEY_PASSWORD.toCharArray());
        assertEquals(new String(storedSecretKey.getEncoded()), passwordKey);
    } catch (final RuntimeException re) {
        re.printStackTrace();
        fail(re.getMessage());
    }
}