FutureCacheWrapper implements FutureCache<K, V> { @Override public Future<Map<K, V>> putAll(Map<K, V> map, long expiry, TimeUnit unit) { return future(config.delegate.putAll(map, expiry, unit)); } private  FutureCacheWrapper(Builder<K, V> config); @Override Future<V> get(K key); @Override Future<V> put(K key, V value, long expiry, TimeUnit unit); @Override Future<K> remove(K key); @Override Future<Map<K, V>> getAll(Collection<K> keys); @Override Future<Map<K, V>> putAll(Map<K, V> map, long expiry, TimeUnit unit); @Override Future<Collection<K>> removeAll(Collection<K> keys); static Builder<K, V> newBuilder(Class<K> keyType, Class<V> valueType);  }
@Test public void testPutAll() throws ExecutionException, InterruptedException { final Map<String, String> map = new HashMap<>(); map.put("hello", "world"); map.put("foo", "bar"); map.put("mal", "reynolds"); final Single<Map<String, String>> single = Single.create(new Single.OnSubscribe<Map<String, String>>() { @Override public void call(SingleSubscriber<? super Map<String, String>> singleSubscriber) { singleSubscriber.onSuccess(map); } }); when(delegate.putAll(map, 10, TimeUnit.MINUTES)).thenReturn(single); final Future<Map<String, String>> foo = wrapper.putAll(map, 10, TimeUnit.MINUTES); final Map<String, String> result = foo.get(); assertThat(result).isEqualTo(map); }