### Question:
Jnacl implements Encryptor { @Override public byte[] seal( final byte[] message, final Nonce nonce, final PublicKey publicKey, final PrivateKey privateKey) { LOGGER.debug( "Sealing message using nonce {}, public key {} and private key {}", nonce, publicKey, privateKey); try { final NaCl nacl = new NaCl(privateKey.getKeyBytes(), publicKey.getKeyBytes()); final byte[] cipherText = nacl.encrypt(message, nonce.getNonceBytes()); LOGGER.debug( "Created sealed payload using nonce {}, public key {} and private key {}", nonce, publicKey, privateKey); return extract(cipherText, crypto_secretbox_BOXZEROBYTES); } catch (final Exception ex) { throw new EncryptorException(ex.getMessage()); } } Jnacl(final SecureRandom secureRandom, final SecretBox secretBox); @Override SharedKey computeSharedKey(final PublicKey publicKey, final PrivateKey privateKey); @Override byte[] seal(
            final byte[] message, final Nonce nonce, final PublicKey publicKey, final PrivateKey privateKey); @Override byte[] open(
            final byte[] cipherText, final Nonce nonce, final PublicKey publicKey, final PrivateKey privateKey); @Override byte[] sealAfterPrecomputation(final byte[] message, final Nonce nonce, final SharedKey sharedKey); @Override byte[] openAfterPrecomputation(final byte[] cipherText, final Nonce nonce, final SharedKey sharedKey); @Override Nonce randomNonce(); @Override KeyPair generateNewKeys(); @Override SharedKey createSingleKey();  }### Answer:
@Test public void sealUsingKeysThrowsExceptionOnFailure() { final Throwable kaclEx = catchThrowable(() -> this.jnacl.seal(message, nonce, publicKey, PrivateKey.from(new byte[] {}))); assertThat(kaclEx).isInstanceOf(EncryptorException.class).hasMessage("Private key too short"); }
@Test public void sealUsingKeysSodiumReturnsSuccess() { final byte[] results = this.jnacl.seal(message, nonce, publicKey, privateKey); assertThat(results).isNotEmpty(); }