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