SHA1HashGenerator implements HashGenerator { @Override public String hash(InputStream in) throws IOException { return DigestUtils.sha1Hex(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("a8145a4737bc7dbc192e7ca49d563f598e9e07a4", hash); }