@Test public void shouldReturnPositiveIntegerBetweenZeroAndIntegerMAX() { Generator<Integer> randomPositiveIntegerGenerator = new RandomPositiveIntegerGenerator(); for (int i = 0; i < 100; i++) { assertThat(randomPositiveIntegerGenerator.next(), greaterThanOrEqualTo(0)); } }
@Override public Integer next() { return from + random.nextInt(to - from); }
RandomPositiveIntegerGenerator implements Generator<Integer> { @Override public Integer next() { return from + random.nextInt(to - from); } }
RandomPositiveIntegerGenerator implements Generator<Integer> { @Override public Integer next() { return from + random.nextInt(to - from); } RandomPositiveIntegerGenerator(int from, int to);  RandomPositiveIntegerGenerator(); }
RandomPositiveIntegerGenerator implements Generator<Integer> { @Override public Integer next() { return from + random.nextInt(to - from); } RandomPositiveIntegerGenerator(int from, int to);  RandomPositiveIntegerGenerator(); @Override Integer next(); }
RandomPositiveIntegerGenerator implements Generator<Integer> { @Override public Integer next() { return from + random.nextInt(to - from); } RandomPositiveIntegerGenerator(int from, int to);  RandomPositiveIntegerGenerator(); @Override Integer next();  }