### Question:
AesCbcCipher { public static String encryptString(String secret, SecretKey aesKey) throws SakuliCipherException { final SecureRandom rng = new SecureRandom(); final byte[] ciphertext = encryptBytes(rng, aesKey, convertStringToBytes(secret)); return new BASE64Encoder().encode(ciphertext); }  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 = "Provided AES key is null or empty") public void testKeyNull() throws Exception { AesCbcCipher.encryptString("bkkala", null); }
@Test(expectedExceptions = SakuliCipherException.class, expectedExceptionsMessageRegExp = "Empty secret can not en-/decrypted!") public void testSecretEmpty() throws Exception { AesCbcCipher.encryptString("", AesKeyHelper.createRandomKey()); }
@Test(expectedExceptions = SakuliCipherException.class, expectedExceptionsMessageRegExp = "Empty secret can not en-/decrypted!") public void testSecretNull() throws Exception { AesCbcCipher.encryptString(null, AesKeyHelper.createRandomKey()); }