HasherHash implements StatefulHash { @Override public StatefulHash createNew() { return new HasherHash(function, algorithm); } HasherHash(HashFunction function, String algorithm); @Override String algorithm(); @Override int length(); @Override boolean supportsUnsafe(); @Override StatefulHash createNew(); @Override boolean supportsIncremental(); @Override void reset(); @Override void update(byte[] input); @Override void update(byte[] input, int index, int length); @Override void update(ByteBuffer input); @Override void update(long address, long length); @Override byte[] getBytes(); @Override int getBytes(byte[] output, int index, int maxLength); @Override byte getByte(); @Override short getShort(); @Override int getInt(); @Override long getLong();  }
@Test public void testCreateNew() { hash.update(DATA); assertEquals(0xd0ee1ee0bb3bb65eL, hash.getLong()); final StatefulHash other = hash.createNew(); assertEquals(0x04b2008fd98c1dd4L, other.getLong()); assertEquals(0xd0ee1ee0bb3bb65eL, hash.getLong()); }