@Test(expected = GeneralSecurityException.class)
public void testLoadEncryptedPrivateKeyFromKeyStoreWithWrongPassword() throws GeneralSecurityException, IOException {

    if (!x509TestContext.isKeyStoreEncrypted()) {
        throw new GeneralSecurityException(); // this case is not tested so throw the expected exception
    }
    PemReader.loadPrivateKey(
            x509TestContext.getKeyStoreFile(KeyStoreFileType.PEM),
            Optional.of("wrong password"));
}