IteratorIterableResultAdapter extends AbstractIterableResultAdapter<Iterator> { @Override public boolean accepts(Invocation invocation, Object originalValue) { return originalValue instanceof Iterable && Iterator.class.equals( invocation.getMethod().getReturnType()); } IteratorIterableResultAdapter(); @Override boolean accepts(Invocation invocation, Object originalValue);  }
@Test public void testAccepting() throws Exception { final IteratorIterableResultAdapter adapter = new IteratorIterableResultAdapter(); assertThat(adapter.accepts(null, null), is(false)); assertThat(adapter.accepts( new ImmutableInvocation(ReturnTypeSampleRepository.class.getMethod("findOther"), new Object[]{}), new Object()), is(false)); assertThat(adapter.accepts( new ImmutableInvocation(ReturnTypeSampleRepository.class.getMethod("findIterator"), new Object[]{}), new Object()), is(false)); assertThat(adapter.accepts( new ImmutableInvocation(ReturnTypeSampleRepository.class.getMethod("findIterator"), new Object[]{}), new ArrayList<>()), is(true)); }