### Question:
ChunkHasher { public ChunkHash computeHash(byte[] plaintext) throws InvalidKeyException { try { Mac mac = Mac.getInstance(MAC_ALGORITHM); mac.init(mSecretKey); return new ChunkHash(mac.doFinal(plaintext)); } catch (NoSuchAlgorithmException e) { throw new AssertionError(e); } } ChunkHasher(SecretKey secretKey); ChunkHash computeHash(byte[] plaintext);  }### Answer:
@Test public void computeHash_returnsHmacForData() throws Exception { ChunkHash chunkHash = mChunkHasher.computeHash(TEST_DATA); byte[] hash = chunkHash.getHash(); Mac mac = Mac.getInstance(MAC_ALGORITHM); mac.init(mSecretKey); byte[] expectedHash = mac.doFinal(TEST_DATA); assertThat(hash).isEqualTo(expectedHash); }
@Test public void computeHash_generates256BitHmac() throws Exception { int expectedLength = 256 / Byte.SIZE; byte[] hash = mChunkHasher.computeHash(TEST_DATA).getHash(); assertThat(hash).hasLength(expectedLength); }