@Test public void testGet() throws ExecutionException, InterruptedException { final Single<String> single = Single.create(new Single.OnSubscribe<String>() { @Override public void call(SingleSubscriber<? super String> singleSubscriber) { singleSubscriber.onSuccess("bar"); } }); when(delegate.get("foo")).thenReturn(single); final Future<String> foo = wrapper.get("foo"); final String result = foo.get(); assertThat(result).isEqualTo("bar"); }
@Override public Future<V> get(K key) { return future(config.delegate.get(key)); }
FutureCacheWrapper implements FutureCache<K, V> { @Override public Future<V> get(K key) { return future(config.delegate.get(key)); } }
FutureCacheWrapper implements FutureCache<K, V> { @Override public Future<V> get(K key) { return future(config.delegate.get(key)); } private  FutureCacheWrapper(Builder<K, V> config); }
FutureCacheWrapper implements FutureCache<K, V> { @Override public Future<V> get(K key) { return future(config.delegate.get(key)); } 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); }
FutureCacheWrapper implements FutureCache<K, V> { @Override public Future<V> get(K key) { return future(config.delegate.get(key)); } 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);  }