35
35
import static java .util .Collections .emptyList ;
36
36
import static java .util .Collections .singletonList ;
37
37
import static org .awaitility .Awaitility .await ;
38
- import static org .dataloader .DataLoaderFactory .* ;
38
+ import static org .dataloader .DataLoaderFactory .newDataLoader ;
39
39
import static org .dataloader .DataLoaderOptions .newOptions ;
40
40
import static org .dataloader .TestKit .listFrom ;
41
41
import static org .dataloader .impl .CompletableFutureKit .cause ;
@@ -244,7 +244,9 @@ public void should_Clear_single_value_in_loader() throws ExecutionException, Int
244
244
assertThat (future2 .get (), equalTo ("B" ));
245
245
assertThat (loadCalls , equalTo (singletonList (asList ("A" , "B" ))));
246
246
247
- identityLoader .clear ("A" );
247
+ // fluency
248
+ DataLoader <String , String > dl = identityLoader .clear ("A" );
249
+ assertThat (dl , equalTo (identityLoader ));
248
250
249
251
CompletableFuture <String > future1a = identityLoader .load ("A" );
250
252
CompletableFuture <String > future2a = identityLoader .load ("B" );
@@ -270,7 +272,8 @@ public void should_Clear_all_values_in_loader() throws ExecutionException, Inter
270
272
assertThat (future2 .get (), equalTo ("B" ));
271
273
assertThat (loadCalls , equalTo (singletonList (asList ("A" , "B" ))));
272
274
273
- identityLoader .clearAll ();
275
+ DataLoader <String , String > dlFluent = identityLoader .clearAll ();
276
+ assertThat (dlFluent , equalTo (identityLoader )); // fluency
274
277
275
278
CompletableFuture <String > future1a = identityLoader .load ("A" );
276
279
CompletableFuture <String > future2a = identityLoader .load ("B" );
@@ -287,7 +290,8 @@ public void should_Allow_priming_the_cache() throws ExecutionException, Interrup
287
290
List <Collection <String >> loadCalls = new ArrayList <>();
288
291
DataLoader <String , String > identityLoader = idLoader (new DataLoaderOptions (), loadCalls );
289
292
290
- identityLoader .prime ("A" , "A" );
293
+ DataLoader <String , String > dlFluency = identityLoader .prime ("A" , "A" );
294
+ assertThat (dlFluency , equalTo (identityLoader ));
291
295
292
296
CompletableFuture <String > future1 = identityLoader .load ("A" );
293
297
CompletableFuture <String > future2 = identityLoader .load ("B" );
0 commit comments