### Question:
RandomPositiveLongGenerator implements Generator<Long> { @Override public Long next() { return from + random.nextLong(to - from); } RandomPositiveLongGenerator(long from, long to);  RandomPositiveLongGenerator(); @Override Long next();  }### Answer:
@Test public void shouldReturnPositiveLongBetweenZeroAndIntegerMAX() { Generator<Long> randomPositiveLongGenerator = new RandomPositiveLongGenerator(); for (int i = 0; i < 100; i++) { assertThat(randomPositiveLongGenerator.next(), greaterThanOrEqualTo(0L)); } }
@Test public void shouldReturnPositiveIntegerBetweenFromInclusiveAndToExclusive() { long from = 13; long to = 20; Generator<Long> randomPositiveLongGenerator = new RandomPositiveLongGenerator(from, to); Set<Long> generatedNumbers = newHashSet(); for (int i = 0; i < 100; i++) { Long generatedLong = randomPositiveLongGenerator.next(); assertThat(generatedLong, greaterThanOrEqualTo(from)); assertThat(generatedLong, lessThan(to)); generatedNumbers.add(generatedLong); } assertThat(generatedNumbers, hasSize(greaterThan(5))); }