@SuppressWarnings("deprecation")
@Test
public void testRetrievePrivateKeyInValid() {

    
    FilePrivateKeyStoreFactory factory = new FilePrivateKeyStoreFactory();
    PrivateKeyStore store = factory.create();
    
    String saveProp = System.getProperty(FilePrivateKeyStore.ATHENZ_PROP_PRIVATE_KEY);
    System.setProperty(FilePrivateKeyStore.ATHENZ_PROP_PRIVATE_KEY,
            "src/test/resources/zts_private_k0_invalid.pem");
    
    try {
        StringBuilder keyId = new StringBuilder(256);
        store.getPrivateKey("zts", "localhost", keyId);
        fail();
    } catch (Exception ex) {
        assertTrue(true);
    }
    System.clearProperty(FilePrivateKeyStore.ATHENZ_PROP_PRIVATE_KEY);
    StringBuilder keyId = new StringBuilder(256);
    assertNull(store.getPrivateKey("zts", "localhost", keyId));
    if (saveProp == null) {
        System.clearProperty(FilePrivateKeyStore.ATHENZ_PROP_PRIVATE_KEY);
    } else {
        System.setProperty(FilePrivateKeyStore.ATHENZ_PROP_PRIVATE_KEY, saveProp);
    }
}