### Question:
AES256v2Cryptor implements JNCryptor { byte[] encryptData(byte[] plaintext, char[] password, byte[] encryptionSalt, byte[] hmacSalt, byte[] iv) throws CryptorException { SecretKey encryptionKey = keyForPassword(password, encryptionSalt); SecretKey hmacKey = keyForPassword(password, hmacSalt); try { Cipher cipher = Cipher.getInstance(AES_CIPHER_ALGORITHM); cipher.init(Cipher.ENCRYPT_MODE, encryptionKey, new IvParameterSpec(iv)); byte[] ciphertext = cipher.doFinal(plaintext); AES256v2Ciphertext output = new AES256v2Ciphertext(encryptionSalt, hmacSalt, iv, ciphertext); Mac mac = Mac.getInstance(HMAC_ALGORITHM); mac.init(hmacKey); byte[] hmac = mac.doFinal(output.getDataToHMAC()); output.setHmac(hmac); return output.getRawData(); } catch (GeneralSecurityException e) { throw new CryptorException("Failed to generate ciphertext.", e); } } AES256v2Cryptor(); @Override SecretKey keyForPassword(char[] password, byte[] salt); @Override byte[] decryptData(byte[] ciphertext, char[] password); @Override byte[] encryptData(byte[] plaintext, char[] password); @Override int getVersionNumber(); @Override byte[] decryptData(byte[] ciphertext, SecretKey decryptionKey,
      SecretKey hmacKey); @Override byte[] encryptData(byte[] plaintext, SecretKey encryptionKey,
      SecretKey hmacKey);  }### Answer:
@Test(expected = NullPointerException.class) public void testNullPlaintextInEncrypt() throws Exception { new AES256v2Cryptor().encryptData(null, "blah".toCharArray()); }