### Question:
Ed25519BlockCipher implements BlockCipher { @Override public byte[] decrypt(final byte[] input) { if (input == null) { throw new CryptoException("Cannot decrypt. Input is required."); } int minSize = TAG_LENGTH + IV_LENGTH; if (input.length < minSize) { throw new CryptoException( "Cannot decrypt input. Size is " + input.length + " when at least " + minSize + " is expected."); } final byte[] authTag = Arrays.copyOfRange(input, 0, TAG_LENGTH); final byte[] ivData = Arrays.copyOfRange(input, TAG_LENGTH, IV_LENGTH + TAG_LENGTH); final byte[] cypherText = Arrays.copyOfRange(input, TAG_LENGTH + IV_LENGTH, input.length); return decode(authTag, ivData, cypherText); } Ed25519BlockCipher(final KeyPair senderKeyPair, final KeyPair recipientKeyPair); @Override byte[] encrypt(final byte[] plainText); byte[] encrypt(final byte[] plainText, final byte[] ivData); AuthenticatedCipherText encode(final byte[] plainText, final byte[] ivData); @Override byte[] decrypt(final byte[] input); byte[] decode(byte[] authTag, byte[] ivData, byte[] cypherText); static byte[] getSharedKey(final PrivateKey privateKey, final PublicKey publicKey); static byte[] getSharedSecret(final PrivateKey privateKey, final PublicKey publicKey);  }### Answer:
@Test public void decryptFailsInputIsTooSmallInLength() { final CryptoEngine engine = this.getCryptoEngine(); final KeyPair kp = KeyPair.random(engine); final BlockCipher blockCipher = this.getBlockCipher(kp, kp); CryptoException exception = Assertions.assertThrows(CryptoException.class, () -> blockCipher.decrypt(new byte[27])); Assertions.assertEquals( "Cannot decrypt input. Size is 27 when at least 28 is expected.", exception.getMessage()); }
@Test public void decryptFailsIfInputIsNull() { final CryptoEngine engine = this.getCryptoEngine(); final KeyPair kp = KeyPair.random(engine); final BlockCipher blockCipher = this.getBlockCipher(kp, kp); CryptoException exception = Assertions.assertThrows(CryptoException.class, () -> blockCipher.decrypt(null)); Assertions.assertEquals("Cannot decrypt. Input is required.", exception.getMessage()); }