@@ -692,13 +692,13 @@ public void should_work_with_duplicate_keys_when_caching_enabled() throws Execut
692
692
public void should_Accept_objects_with_a_complex_key () throws ExecutionException , InterruptedException {
693
693
List <Collection <JsonObject >> loadCalls = new ArrayList <>();
694
694
DataLoaderOptions options = newOptions ().setCacheKeyFunction (getJsonObjectCacheMapFn ());
695
- DataLoader <JsonObject , Integer > identityLoader = idLoader (options , loadCalls );
695
+ DataLoader <JsonObject , JsonObject > identityLoader = idLoader (options , loadCalls );
696
696
697
697
JsonObject key1 = new JsonObject ().put ("id" , 123 );
698
698
JsonObject key2 = new JsonObject ().put ("id" , 123 );
699
699
700
- CompletableFuture <Integer > future1 = identityLoader .load (key1 );
701
- CompletableFuture <Integer > future2 = identityLoader .load (key2 );
700
+ CompletableFuture <JsonObject > future1 = identityLoader .load (key1 );
701
+ CompletableFuture <JsonObject > future2 = identityLoader .load (key2 );
702
702
identityLoader .dispatch ();
703
703
704
704
await ().until (() -> future1 .isDone () && future2 .isDone ());
@@ -713,18 +713,18 @@ public void should_Accept_objects_with_a_complex_key() throws ExecutionException
713
713
public void should_Clear_objects_with_complex_key () throws ExecutionException , InterruptedException {
714
714
List <Collection <JsonObject >> loadCalls = new ArrayList <>();
715
715
DataLoaderOptions options = newOptions ().setCacheKeyFunction (getJsonObjectCacheMapFn ());
716
- DataLoader <JsonObject , Integer > identityLoader = idLoader (options , loadCalls );
716
+ DataLoader <JsonObject , JsonObject > identityLoader = idLoader (options , loadCalls );
717
717
718
718
JsonObject key1 = new JsonObject ().put ("id" , 123 );
719
719
JsonObject key2 = new JsonObject ().put ("id" , 123 );
720
720
721
- CompletableFuture <Integer > future1 = identityLoader .load (key1 );
721
+ CompletableFuture <JsonObject > future1 = identityLoader .load (key1 );
722
722
identityLoader .dispatch ();
723
723
724
724
await ().until (future1 ::isDone );
725
725
identityLoader .clear (key2 ); // clear equivalent object key
726
726
727
- CompletableFuture <Integer > future2 = identityLoader .load (key1 );
727
+ CompletableFuture <JsonObject > future2 = identityLoader .load (key1 );
728
728
identityLoader .dispatch ();
729
729
730
730
await ().until (future2 ::isDone );
@@ -737,22 +737,22 @@ public void should_Clear_objects_with_complex_key() throws ExecutionException, I
737
737
public void should_Accept_objects_with_different_order_of_keys () throws ExecutionException , InterruptedException {
738
738
List <Collection <JsonObject >> loadCalls = new ArrayList <>();
739
739
DataLoaderOptions options = newOptions ().setCacheKeyFunction (getJsonObjectCacheMapFn ());
740
- DataLoader <JsonObject , Integer > identityLoader = idLoader (options , loadCalls );
740
+ DataLoader <JsonObject , JsonObject > identityLoader = idLoader (options , loadCalls );
741
741
742
742
JsonObject key1 = new JsonObject ().put ("a" , 123 ).put ("b" , 321 );
743
743
JsonObject key2 = new JsonObject ().put ("b" , 321 ).put ("a" , 123 );
744
744
745
745
// Fetches as expected
746
746
747
- CompletableFuture <Integer > future1 = identityLoader .load (key1 );
748
- CompletableFuture <Integer > future2 = identityLoader .load (key2 );
747
+ CompletableFuture <JsonObject > future1 = identityLoader .load (key1 );
748
+ CompletableFuture <JsonObject > future2 = identityLoader .load (key2 );
749
749
identityLoader .dispatch ();
750
750
751
751
await ().until (() -> future1 .isDone () && future2 .isDone ());
752
752
assertThat (loadCalls , equalTo (singletonList (singletonList (key1 ))));
753
753
assertThat (loadCalls .size (), equalTo (1 ));
754
754
assertThat (future1 .get (), equalTo (key1 ));
755
- assertThat (future2 .get (), equalTo (key1 ));
755
+ assertThat (future2 .get (), equalTo (key2 ));
756
756
}
757
757
758
758
@ Test
0 commit comments