PeCryptoUtils { public static String decrypt(String value) { if (cryptoUtils == null || StringUtils.isBlank(value)) { return value; } return decryptCache.computeIfAbsent(value, cryptoUtils::decrypt); } private  PeCryptoUtils(); static synchronized void initAesKey(String theSecretKey); static String encrypt(String value); static String decrypt(String value);  }
@Test public void testDecrypt() throws Exception { assertEquals(pass, PeCryptoUtils.decrypt(pass)); System.setProperty(PROP_AES_KEY, secretKey); PeCryptoUtils.initAesKey(null); System.clearProperty(PROP_AES_KEY); assertEquals(pass, PeCryptoUtils.decrypt(encryptedPass)); Whitebox.setInternalState(PeCryptoUtils.class, "cryptoUtils", (PeCryptoUtils) null); Whitebox.setInternalState(PeCryptoUtils.class, "secretKey", secretKey); PeCryptoUtils.initAesKey(" "); assertEquals(pass, PeCryptoUtils.decrypt(pass)); }