use of com.optimizely.ab.optimizelydecision.OptimizelyDecideOption in project java-sdk by optimizely.
the class OptimizelyUserContextTest method decideOptions_defaultDecideOptions.
@Test
public void decideOptions_defaultDecideOptions() {
List<OptimizelyDecideOption> options = Arrays.asList(OptimizelyDecideOption.EXCLUDE_VARIABLES);
optimizely = Optimizely.builder().withDatafile(datafile).withDefaultDecideOptions(options).build();
String flagKey = "feature_1";
OptimizelyUserContext user = optimizely.createUserContext(userId);
// should be excluded by DefaultDecideOption
OptimizelyDecision decision = user.decide(flagKey);
assertTrue(decision.getVariables().toMap().size() == 0);
decision = user.decide(flagKey, Arrays.asList(OptimizelyDecideOption.INCLUDE_REASONS, OptimizelyDecideOption.EXCLUDE_VARIABLES));
// other options should work as well
assertTrue(decision.getReasons().size() > 0);
// redundant setting ignored
assertTrue(decision.getVariables().toMap().size() == 0);
}
Aggregations