WindowIterator implements Iterator<List<T>> { @Override public boolean hasNext() { return iterator.hasNext(); } WindowIterator(Iterator<T> iterator, int windowSize); @Override boolean hasNext(); @Override List<T> next(); @Override void remove();  }
@Test public void testHasNextReturnsTrueWhenInputHasRemainingItems() { int windowSize = 3; Iterable<Object> iterable = Arrays.<Object>asList(0, 1, 2, 3); WindowIterator<Object> windowIterator = new WindowIterator<>(iterable.iterator(), windowSize); boolean hasNext = windowIterator.hasNext(); assertThat(hasNext, is(true)); }