CollectionIterableResultAdapter extends AbstractIterableResultAdapter<Collection> { @Override public boolean accepts(Invocation invocation, Object originalValue) { return originalValue instanceof Iterable && Collection.class.isAssignableFrom( invocation.getMethod().getReturnType()); } CollectionIterableResultAdapter(); @Override boolean accepts(Invocation invocation, Object originalValue);  }
@Test public void testAccepts() throws Exception { final CollectionIterableResultAdapter adapter = new CollectionIterableResultAdapter(); assertThat(adapter.accepts( new ImmutableInvocation(ReturnTypeSampleRepository.class.getMethod("findCustomCollection"), null), null), is(false)); assertThat(adapter.accepts( new ImmutableInvocation(ReturnTypeSampleRepository.class.getMethod("findCustomCollection"), null), new Object()), is(false)); assertThat(adapter.accepts( new ImmutableInvocation(ReturnTypeSampleRepository.class.getMethod("findCustomCollection"), null), new ArrayList<>()), is(true)); assertThat(adapter.accepts(new ImmutableInvocation(ReturnTypeSampleRepository.class.getMethod("findSet"), null), new ArrayList<>()), is(true)); assertThat( adapter.accepts(new ImmutableInvocation(ReturnTypeSampleRepository.class.getMethod("findOther"), null), new ArrayList<>()), is(false)); }