### Question:
SecretBox { public byte[] encrypt(byte[] nonce, byte[] message) { checkLength(nonce, XSALSA20_POLY1305_SECRETBOX_NONCEBYTES); byte[] msg = Util.prependZeros(ZERO_BYTES, message); byte[] ct = Util.zeros(msg.length); isValid(sodium().crypto_secretbox_xsalsa20poly1305(ct, msg, msg.length, nonce, key), "Encryption failed"); return removeZeros(BOXZERO_BYTES, ct); } SecretBox(byte[] key);  SecretBox(String key, Encoder encoder); byte[] encrypt(byte[] nonce, byte[] message); byte[] decrypt(byte[] nonce, byte[] ciphertext);  }### Answer:
@Test public void testEncrypt() throws Exception { SecretBox box = new SecretBox(SECRET_KEY, HEX); byte[] nonce = HEX.decode(BOX_NONCE); byte[] message = HEX.decode(BOX_MESSAGE); byte[] ciphertext = HEX.decode(BOX_CIPHERTEXT); byte[] result = box.encrypt(nonce, message); assertTrue("failed to generate ciphertext", Arrays.equals(result, ciphertext)); }