@@ -1223,6 +1223,19 @@ public void setForcedDecisionWithoutRuleKeyTest() {
12231223 assertEquals (forcedDecision .getVariationKey (), variationKey );
12241224 }
12251225
1226+ @ Test
1227+ public void setForcedDecisionWithoutRuleKeyTestSdkNotReady () {
1228+ String flagKey = "55555" ;
1229+ String variationKey = "33333" ;
1230+ Optimizely optimizely = new Optimizely .Builder ().build ();
1231+ OptimizelyUserContext optimizelyUserContext = new OptimizelyUserContext (
1232+ optimizely ,
1233+ userId ,
1234+ Collections .emptyMap ());
1235+
1236+ assertFalse (optimizelyUserContext .setForcedDecision (flagKey , variationKey ));
1237+ }
1238+
12261239 @ Test
12271240 public void getForcedVariationWithRuleKey () {
12281241 String flagKey = "55555" ;
@@ -1265,6 +1278,20 @@ public void getForcedVariationWithoutRuleKey() {
12651278 assertEquals (variationKey , optimizelyUserContext .getForcedDecision (flagKey ));
12661279 }
12671280
1281+ @ Test
1282+ public void getForcedVariationWithoutRuleKeySdkNotReady () {
1283+ String flagKey = "55555" ;
1284+ String variationKey = "33333" ;
1285+ Optimizely optimizely = new Optimizely .Builder ().build ();
1286+ OptimizelyUserContext optimizelyUserContext = new OptimizelyUserContext (
1287+ optimizely ,
1288+ userId ,
1289+ Collections .emptyMap ());
1290+
1291+ optimizelyUserContext .setForcedDecision (flagKey , variationKey );
1292+ assertNull (optimizelyUserContext .getForcedDecision (flagKey ));
1293+ }
1294+
12681295 @ Test
12691296 public void failedGetForcedDecisionWithoutRuleKey () {
12701297 String flagKey = "55555" ;
@@ -1290,7 +1317,7 @@ public void removeForcedDecisionWithRuleKey() {
12901317 Collections .emptyMap ());
12911318
12921319 optimizelyUserContext .setForcedDecision (flagKey , ruleKey , variationKey );
1293- assertEquals ( true , optimizelyUserContext .removeForcedDecision (flagKey , ruleKey ));
1320+ assertTrue ( optimizelyUserContext .removeForcedDecision (flagKey , ruleKey ));
12941321 }
12951322
12961323 @ Test
@@ -1303,7 +1330,21 @@ public void removeForcedDecisionWithoutRuleKey() {
13031330 Collections .emptyMap ());
13041331
13051332 optimizelyUserContext .setForcedDecision (flagKey , variationKey );
1306- assertEquals (true , optimizelyUserContext .removeForcedDecision (flagKey ));
1333+ assertTrue (optimizelyUserContext .removeForcedDecision (flagKey ));
1334+ }
1335+
1336+ @ Test
1337+ public void removeForcedDecisionWithoutRuleKeySdkNotReady () {
1338+ String flagKey = "55555" ;
1339+ String variationKey = "33333" ;
1340+ Optimizely optimizely = new Optimizely .Builder ().build ();
1341+ OptimizelyUserContext optimizelyUserContext = new OptimizelyUserContext (
1342+ optimizely ,
1343+ userId ,
1344+ Collections .emptyMap ());
1345+
1346+ optimizelyUserContext .setForcedDecision (flagKey , variationKey );
1347+ assertFalse (optimizelyUserContext .removeForcedDecision (flagKey ));
13071348 }
13081349
13091350 @ Test
@@ -1320,7 +1361,25 @@ public void removeAllForcedDecisions() {
13201361
13211362 optimizelyUserContext .setForcedDecision (flagKey1 , ruleKey1 , variationKey1 );
13221363 optimizelyUserContext .setForcedDecision (flagKey2 , variationKey2 );
1323- assertEquals (true , optimizelyUserContext .removeAllForcedDecisions ());
1364+ assertTrue (optimizelyUserContext .removeAllForcedDecisions ());
1365+ }
1366+
1367+ @ Test
1368+ public void removeAllForcedDecisionsSdkNotReady () {
1369+ String flagKey1 = "55555" ;
1370+ String ruleKey1 = "77777" ;
1371+ String variationKey1 = "33333" ;
1372+ String flagKey2 = "11" ;
1373+ String variationKey2 = "5" ;
1374+ Optimizely optimizely = new Optimizely .Builder ().build ();
1375+ OptimizelyUserContext optimizelyUserContext = new OptimizelyUserContext (
1376+ optimizely ,
1377+ userId ,
1378+ Collections .emptyMap ());
1379+
1380+ optimizelyUserContext .setForcedDecision (flagKey1 , ruleKey1 , variationKey1 );
1381+ optimizelyUserContext .setForcedDecision (flagKey2 , variationKey2 );
1382+ assertFalse (optimizelyUserContext .removeAllForcedDecisions ());
13241383 }
13251384
13261385 @ Test
0 commit comments