NullToSliceResultAdapter extends AbstractResultAdapter<Slice> { @Override public boolean accepts(Invocation invocation, Object originalValue) { return originalValue == null && Slice.class.isAssignableFrom(invocation.getMethod().getReturnType()); } NullToSliceResultAdapter(); @Override boolean accepts(Invocation invocation, Object originalValue); @Override Slice adapt(Invocation invocation, Object originalValue);  }
@Test public void testAcceptance() throws Exception { final ResultAdapter<Slice> adapter = new NullToSliceResultAdapter(); assertThat(adapter.accepts( new ImmutableInvocation(ReturnTypeSampleRepository.class.getMethod("findSlice"), new Object[]{}), null), is(true)); assertThat(adapter.accepts( new ImmutableInvocation(ReturnTypeSampleRepository.class.getMethod("findPage"), new Object[]{}), null), is(true)); assertThat(adapter.accepts( new ImmutableInvocation(ReturnTypeSampleRepository.class.getMethod("findGeoPage"), new Object[]{}), null), is(true)); }