use of com.optimizely.ab.config.audience.NotCondition in project java-sdk by optimizely.
the class DatafileProjectConfigTest method verifyGetAudienceConditionsFromValidId.
/**
* Asserts that getAudience returns the respective audience, provided the
* audience ID parameter is valid.
*/
@Test
public void verifyGetAudienceConditionsFromValidId() throws Exception {
List<Condition> userAttributes = new ArrayList<Condition>();
userAttributes.add(new UserAttribute("browser_type", "custom_attribute", null, "firefox"));
OrCondition orInner = new OrCondition(userAttributes);
NotCondition notCondition = new NotCondition(orInner);
List<Condition> outerOrList = new ArrayList<Condition>();
outerOrList.add(notCondition);
OrCondition orOuter = new OrCondition(outerOrList);
List<Condition> andList = new ArrayList<Condition>();
andList.add(orOuter);
Condition expectedConditions = new AndCondition(andList);
Condition actualConditions = projectConfig.getAudience("100").getConditions();
assertThat(actualConditions, is(expectedConditions));
}
Aggregations