### Question:
SPPCounter { public synchronized Iterator<Long> increment(final int delta) { final long old = counter; counter = (counter + delta) % wrap; return new Iterator<Long>() { private long c = old; private int d = delta; @Override public boolean hasNext() { return d > 0; } @Override public Long next() { if (!hasNext()) { throw new NoSuchElementException(); } d--; c = (c + 1) % wrap; return c; } @Override public void remove() { throw new UnsupportedOperationException("Not supported."); } }; } SPPCounter(final long wrap); synchronized Iterator<Long> increment(final int delta);  }### Answer:
@Test public void testIncrement3() { long wrap = 1; int delta = 0; long[] exp = new long[]{}; SPPCounter c = new SPPCounter(wrap); Iterator<Long> iter = c.increment(delta); assertTrue(checkIterator(exp, iter)); }
@Test public void testIncrement4() { long wrap = 1; int delta = 1; long[] exp = new long[]{0}; SPPCounter c = new SPPCounter(wrap); Iterator<Long> iter = c.increment(delta); assertTrue(checkIterator(exp, iter)); }
@Test public void testIncrement5() { long wrap = 1; int delta = 2; long[] exp = new long[]{0, 0}; SPPCounter c = new SPPCounter(wrap); Iterator<Long> iter = c.increment(delta); assertTrue(checkIterator(exp, iter)); }
@Test public void testIncrement6() { long wrap = 5; int delta = 10; long[] exp = new long[]{0, 1, 2, 3, 4, 0, 1, 2, 3, 4}; SPPCounter c = new SPPCounter(wrap); Iterator<Long> iter = c.increment(delta); assertTrue(checkIterator(exp, iter)); }
@Test public void testIncrement7() { long wrap = 3; int delta1 = 10; int delta2 = 5; long[] exp1 = new long[]{0, 1, 2, 0, 1, 2, 0, 1, 2, 0}; long[] exp2 = new long[]{1, 2, 0, 1, 2}; SPPCounter c = new SPPCounter(wrap); Iterator<Long> iter1 = c.increment(delta1); Iterator<Long> iter2 = c.increment(delta2); assertTrue(checkIterator(exp2, iter2)); assertTrue(checkIterator(exp1, iter1)); }
@Test public void testIncrement8() { long wrap = 10; int delta1 = 5; int delta2 = 15; long[] exp1 = new long[]{0, 1, 2, 3, 4}; long[] exp2 = new long[]{5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; SPPCounter c = new SPPCounter(wrap); Iterator<Long> iter1 = c.increment(delta1); Iterator<Long> iter2 = c.increment(delta2); assertTrue(checkIterator(exp1, iter1)); assertTrue(checkIterator(exp2, iter2)); }