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