NullToIteratorResultAdapter extends AbstractResultAdapter<Iterator> { @Override public Iterator adapt(Invocation invocation, Object originalValue) { return EmptyIterator.INSTANCE; } NullToIteratorResultAdapter(); @Override boolean accepts(Invocation invocation, Object originalValue); @Override Iterator adapt(Invocation invocation, Object originalValue);  }
@Test public void testAdaptingToIterable() throws Exception { final ResultAdapter<Iterator> adapter = new NullToIteratorResultAdapter(); final Iterator value = adapter.adapt( new ImmutableInvocation(ReturnTypeSampleRepository.class.getMethod("findIterator"), new Object[]{}), null); assertThat(value, is(notNullValue())); assertThat(value.hasNext(), is(false)); }