AbstractHashGenerator { long distribute(long value) { return rotate(value, 1 + lowestThreeBits(value)); } AbstractHashGenerator(Pseudorandom pseudorandom);   }
@Test public void testDistribute_AtLeastOnce() throws Exception { Pseudorandom pseudorandom = mock(Pseudorandom.class); AbstractHashGenerator f = new AbstractHashGenerator(pseudorandom); long x = f.distribute(8L); verify(pseudorandom, times(1)).next(anyLong()); assertThat(x, is(not(8L))); }
@Test public void testDistribute() throws Exception { Pseudorandom pseudorandom = mock(Pseudorandom.class); AbstractHashGenerator f = new AbstractHashGenerator(pseudorandom); long x = f.distribute(5L); verify(pseudorandom, times(6)).next(anyLong()); assertThat(x, is(not(5L))); }