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