### Question:
Checksum { public Checksum update( byte[] buffer, int offset, int size ) { if (this.result.length!=0) { reset(); } md.update( buffer, 0, size ); return this; } Checksum( ChecksumAlgorithm checksumAlgorithm ); String getChecksum(); byte[] getChecksumBytes(); ChecksumAlgorithm getAlgorithm(); void reset(); Checksum update( byte[] buffer, int offset, int size ); Checksum update( ByteBuffer buffer); Checksum finish(); boolean compare(byte[] cmp); boolean compare(String hexString);  }### Answer:
@Test public void testUpdate() { Checksum checksum = new Checksum( ChecksumAlgorithm.SHA1 ); byte buf[] = ( "You know, I'm sick of following my dreams, man. " + "I'm just going to ask where they're going and hook up with 'em later. - Mitch Hedberg" ).getBytes(); checksum.update( buf, 0, buf.length ); Assert.assertEquals( "Checksum", "e396119ae0542e85a74759602fd2f81e5d36d762", checksum.getChecksum() ); }