### Question:
IncrementingNonceGenerator implements Iterable<Long> { @Override public Iterator<Long> iterator() { return new Iterator<Long>() { @Override public boolean hasNext() { return true; } @Override public Long next() { return nextValue++; } }; } IncrementingNonceGenerator(final long nextValue); @Override Iterator<Long> iterator();  }### Answer:
@Test public void firstValueProvidedIsSuppliedAtConstruction() { final Long initialValue = 0L; final IncrementingNonceGenerator generator = new IncrementingNonceGenerator(initialValue); assertThat(generator.iterator().next()).isEqualTo(initialValue); }
@Test public void rollOverFromMaxResetsToZero() { final Long initialValue = 0xFFFFFFFFFFFFFFFFL; final IncrementingNonceGenerator generator = new IncrementingNonceGenerator(initialValue); assertThat(generator.iterator().next()).isEqualTo(initialValue); final Long nextValue = generator.iterator().next(); assertThat(Long.compareUnsigned(nextValue, 0)).isEqualTo(0); }