@@ -145,47 +145,6 @@ public void can_use_caffeine_for_caching() {
145145 assertArrayEquals (caffeineCache .asMap ().keySet ().toArray (), asList ("a" , "b" , "c" ).toArray ());
146146 }
147147
148- @ Test
149- public void will_invoke_loader_if_CACHE_CONTAINS_call_throws_exception () {
150- CustomCachedValueStore customStore = new CustomCachedValueStore () {
151- @ Override
152- public CompletableFuture <Boolean > containsKey (String key ) {
153- if (key .equals ("a" )) {
154- return failedFuture (new IllegalStateException ("no A" ));
155- }
156- if (key .equals ("c" )) {
157- return completedFuture (false );
158- }
159- return super .containsKey (key );
160- }
161- };
162- customStore .set ("a" , "Not From Cache A" );
163- customStore .set ("b" , "From Cache" );
164- customStore .set ("c" , "Not From Cache C" );
165-
166- List <List <String >> loadCalls = new ArrayList <>();
167- DataLoaderOptions options = newOptions ().setCachedValueStore (customStore );
168- DataLoader <String , String > identityLoader = idLoader (options , loadCalls );
169-
170- // Fetches as expected
171-
172- CompletableFuture <String > fA = identityLoader .load ("a" );
173- CompletableFuture <String > fB = identityLoader .load ("b" );
174- CompletableFuture <String > fC = identityLoader .load ("c" );
175-
176- await ().until (identityLoader .dispatch ()::isDone );
177- assertThat (fA .join (), equalTo ("a" ));
178- assertThat (fB .join (), equalTo ("From Cache" ));
179- assertThat (fC .join (), equalTo ("c" ));
180-
181- // a was not in cache (according to containsKey) and hence needed to be loaded
182- assertThat (loadCalls , equalTo (singletonList (asList ("a" , "c" ))));
183-
184- // the failed containsKey calls will be SET back into the value cache after batch loading
185- assertArrayEquals (customStore .store .keySet ().toArray (), asList ("a" , "b" , "c" ).toArray ());
186- assertArrayEquals (customStore .store .values ().toArray (), asList ("a" , "From Cache" , "c" ).toArray ());
187- }
188-
189148 @ Test
190149 public void will_invoke_loader_if_CACHE_GET_call_throws_exception () {
191150 CustomCachedValueStore customStore = new CustomCachedValueStore () {
0 commit comments