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