### Question:
SequenceSampler implements Sampler<Integer> { public Integer sample() throws Exception { if(end == null || next < end) { Integer current = next; next = current + step; return current; } throw new Exception("All values have been sampled"); } SequenceSampler();  SequenceSampler(Integer start);  SequenceSampler(Integer start, Integer end);  SequenceSampler(Integer start, Integer end, Integer step); Integer sample();  }### Answer:
@Test public void testSample() throws Exception { Sampler<Integer> sampler = new SequenceSampler(0, 10, 1); for(int i = 0; i < 10; i++) { Integer value = sampler.sample(); assertEquals( (int) value, i); } }