### Question:
AesCbcCipher { public static String decryptString(String encryptedStringBase64, SecretKey aesKey) throws SakuliCipherException { if (StringUtils.isEmpty(encryptedStringBase64)) { throw new SakuliCipherException("Empty secret can not en-/decrypted!"); } final byte[] ciphertext; try { ciphertext = new BASE64Decoder().decodeBuffer(encryptedStringBase64); } catch (IOException e) { throw new SakuliCipherException("Can not decrypt invalid Base64 secret: " + encryptedStringBase64); } final byte[] decrypted = decryptBytes(aesKey, ciphertext); return convertBytesToString(decrypted); }  static IvParameterSpec createIV(final int ivSizeBytes, final Optional<SecureRandom> rng); static IvParameterSpec readIV(final int ivSizeBytes, final InputStream is); static byte[] decryptBytes(SecretKey aesKey, byte[] ciphertext); static byte[] encryptBytes(SecureRandom rng, SecretKey aesKey, byte[] plaintext); static String encryptString(String secret, SecretKey aesKey); static String decryptString(String encryptedStringBase64, SecretKey aesKey); static final String CBC_ALGORITHM; }### Answer:
@Test(expectedExceptions = SakuliCipherException.class, expectedExceptionsMessageRegExp = "Empty secret can not en-/decrypted!") public void testSecretNullDecrypt() throws Exception { AesCbcCipher.decryptString(null, AesKeyHelper.createRandomKey()); }
@Test public void testFixedKeyAndSecret() throws Exception { final String masterkey = "Bsqs/IR1jW+eibNrdYvlAQ=="; final String encryptedText = "SZUs7Oy0U9QyC5P3QhphzIPJV9txOkppIsiwproRd8g="; Assert.assertEquals(AesCbcCipher.decryptString(encryptedText, AesKeyHelper.readBase64Keay(masterkey)), "akdfjkald"); }
@Test(expectedExceptions = SakuliCipherException.class, expectedExceptionsMessageRegExp = "Provided AES key is null or empty") public void testKeyNullDecrypt() throws Exception { AesCbcCipher.decryptString("bkkala", null); }
@Test(expectedExceptions = SakuliCipherException.class, expectedExceptionsMessageRegExp = "Empty secret can not en-/decrypted!") public void testSecretEmptyDecrypt() throws Exception { AesCbcCipher.decryptString("", AesKeyHelper.createRandomKey()); }