AtomicSequence { public int next() { return next(limit); } AtomicSequence();  AtomicSequence(final int limit); int next(); int next(final int limit); void reset();  }
@Test void testSimple() { AtomicSequence atomicSequence = new AtomicSequence(3); assertThat(atomicSequence.next()).isEqualTo(0); assertThat(atomicSequence.next()).isEqualTo(1); assertThat(atomicSequence.next()).isEqualTo(2); assertThat(atomicSequence.next()).isEqualTo(0); }
@Test void testCallLimit1() { AtomicSequence atomicSequence = new AtomicSequence(1); assertThat(atomicSequence.next()).isEqualTo(0); assertThat(atomicSequence.next()).isEqualTo(0); assertThat(atomicSequence.next()).isEqualTo(0); assertThat(atomicSequence.next()).isEqualTo(0); assertThat(atomicSequence.next()).isEqualTo(0); }
@Test void testCallLimit2() { AtomicSequence atomicSequence = new AtomicSequence(); assertThat(atomicSequence.next(2)).isEqualTo(0); assertThat(atomicSequence.next(2)).isEqualTo(1); assertThat(atomicSequence.next(2)).isEqualTo(0); assertThat(atomicSequence.next(2)).isEqualTo(1); assertThat(atomicSequence.next(2)).isEqualTo(0); }
@Test void testCallLimit3() { AtomicSequence atomicSequence = new AtomicSequence(3); assertThat(atomicSequence.next()).isEqualTo(0); assertThat(atomicSequence.next()).isEqualTo(1); assertThat(atomicSequence.next()).isEqualTo(2); assertThat(atomicSequence.next()).isEqualTo(0); assertThat(atomicSequence.next()).isEqualTo(1); assertThat(atomicSequence.next()).isEqualTo(2); assertThat(atomicSequence.next()).isEqualTo(0); assertThat(atomicSequence.next()).isEqualTo(1); assertThat(atomicSequence.next()).isEqualTo(2); }