File tree 1 file changed +28
-0
lines changed
core-api/src/test/java/com/optimizely/ab
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -456,6 +456,34 @@ public void decideForKeys_ups_batching() throws Exception {
456
456
assertEquals (savedProfile .userId , userId );
457
457
}
458
458
459
+ @ Test
460
+ public void decideAll_ups_batching () throws Exception {
461
+ UserProfileService ups = mock (UserProfileService .class );
462
+
463
+ optimizely = new Optimizely .Builder ()
464
+ .withDatafile (datafile )
465
+ .withUserProfileService (ups )
466
+ .build ();
467
+
468
+ Map <String , Object > attributes = Collections .singletonMap ("gender" , "f" );
469
+
470
+ OptimizelyUserContext user = optimizely .createUserContext (userId , attributes );
471
+ Map <String , OptimizelyDecision > decisions = user .decideAll ();
472
+
473
+ assertEquals (decisions .size (), 3 );
474
+
475
+ ArgumentCaptor <Map > argumentCaptor = ArgumentCaptor .forClass (Map .class );
476
+
477
+
478
+ verify (ups , times (1 )).lookup (userId );
479
+ verify (ups , times (1 )).save (argumentCaptor .capture ());
480
+
481
+ Map <String , Object > savedUps = argumentCaptor .getValue ();
482
+ UserProfile savedProfile = UserProfileUtils .convertMapToUserProfile (savedUps );
483
+
484
+ assertEquals (savedProfile .userId , userId );
485
+ }
486
+
459
487
@ Test
460
488
public void decideAll_allFlags_enabledFlagsOnly () {
461
489
String flagKey1 = "feature_1" ;
You can’t perform that action at this time.
0 commit comments