@Test public void shouldGenerateLongsInSequence() throws Exception { generator = new SequentialLongGenerator(); List<Long> generatedValues = newArrayList(); for (int i = 0; i < 10; i++) { generatedValues.add(generator.next()); } assertThat(generatedValues, contains(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L)); }
@Override public Long next() { return value.getAndAdd(1L); }
SequentialLongGenerator implements Generator<Long> { @Override public Long next() { return value.getAndAdd(1L); } }
SequentialLongGenerator implements Generator<Long> { @Override public Long next() { return value.getAndAdd(1L); } SequentialLongGenerator(long startAt);  SequentialLongGenerator(); }
SequentialLongGenerator implements Generator<Long> { @Override public Long next() { return value.getAndAdd(1L); } SequentialLongGenerator(long startAt);  SequentialLongGenerator(); @Override Long next(); }
SequentialLongGenerator implements Generator<Long> { @Override public Long next() { return value.getAndAdd(1L); } SequentialLongGenerator(long startAt);  SequentialLongGenerator(); @Override Long next();  }