### Question:
CyclicIterator implements Iterator<T> { @Override public boolean hasNext() { if (shouldContinueCyclingInfinitely()) { return true; } if (shouldNotCycleAtAll()) { return false; } if (iteratorContainsMoreElements()) { return true; } if (!elementsAreCached()) { return false; } return hasRepeatsRemaining(); } CyclicIterator(Iterator<? extends T> iterator);  CyclicIterator(Iterator<? extends T> iterator, int numberOfTimesToRepeat); @Override boolean hasNext(); @Override T next(); @Override void remove(); @Override String toString();  }### Answer:
@Test public void shouldReturnFalseForHasNextIfANumberOfRepeatsOfZeroIsSpecified() throws Exception { Iterable<Integer> input = iterableWith(1, 2); CyclicIterator<Integer> iterator = new CyclicIterator<Integer>(input.iterator(), 0); assertThat(iterator.hasNext(), is(false)); }
@Test public void shouldReturnFalseForHasNextIfAnEmptyIteratorIsSupplied() throws Exception { Iterable<Integer> input = iterableOf(Integer.class); CyclicIterator<Integer> iterator = new CyclicIterator<Integer>(input.iterator()); assertThat(iterator.hasNext(), is(false)); }