@Override
  public Supplier<Object> getResponseSupplier(IMockInvocation invocation) {
    synchronized (LOCK) {
      if (iterator.hasNext()) nextValue = iterator.next();
      Object response = GroovyRuntimeUtil.coerce(nextValue, invocation.getMethod().getReturnType());
      return () -> response;
    }
  }
Generates result values from an iterable object. If the iterator has no more
values left, the previous value is returned.

@author Peter Niederwieser
spock-core/src/main/java/org/spockframework/mock/response/IterableResponseGenerator.java