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