MD5HashGenerator implements HashGenerator { @Override public String hash(InputStream in) throws IOException { return DigestUtils.md5Hex(in); }  @Override String hash(InputStream in);  }
@Test public void testGenerateHashFromInputStream() throws IOException { InputStream in = getClass().getClassLoader().getResourceAsStream("hash/commons-collections-3.2.1-bin.zip"); String hash = hashGenerator.hash(in); assertEquals("23925dbfaf3c266b487c264c1a643b51", hash); }