Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public Boolean evaluate(ProjectConfig config, Map<String, ?> attributes) {
}
}
} catch (UnknownMatchTypeException | UnexpectedValueTypeException e) {
logger.warn("Audience condition \"{}\" " + e.getMessage(), this);
logger.debug("Audience condition \"{}\" " + e.getMessage(), this);
} catch (NullPointerException e) {
logger.error("attribute or value null for match {}", match != null ? match : "legacy condition", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.mockito.internal.matchers.Or;

import java.math.BigInteger;
import java.util.*;
Expand Down Expand Up @@ -165,7 +164,7 @@ public void invalidMatchCondition() throws Exception {
public void invalidMatch() throws Exception {
UserAttribute testInstance = new UserAttribute("browser_type", "custom_attribute", "blah", "chrome");
assertNull(testInstance.evaluate(null, testUserAttributes));
logbackVerifier.expectMessage(Level.WARN,
logbackVerifier.expectMessage(Level.DEBUG,
"Audience condition \"{name='browser_type', type='custom_attribute', match='blah', value='chrome'}\" uses an unknown match type. You may need to upgrade to a newer release of the Optimizely SDK");
}

Expand Down Expand Up @@ -225,6 +224,17 @@ public void unknownConditionType() throws Exception {
"Audience condition \"{name='browser_type', type='blah', match='exists', value='firefox'}\" uses an unknown condition type. You may need to upgrade to a newer release of the Optimizely SDK.");
}

/**
* Verify that UserAttribute.evaluate results of log level of DEBUG for number values passed for revisionNumber
*/
@Test
public void missingConditionType() throws Exception {
UserAttribute testInstance = new UserAttribute("revisionNumber", "custom_attribute", "exact", 17065555);
assertNull(testInstance.evaluate(null, testUserAttributes));
logbackVerifier.expectMessage(Level.DEBUG,
"Audience condition \"{name='revisionNumber', type='custom_attribute', match='exact', value=17065555}\" has an unsupported condition value. You may need to upgrade to a newer release of the Optimizely SDK.");
}

/**
* Verify that UserAttribute.evaluate for EXIST match type returns true for known visitor
* attributes with non-null instances and empty string.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public void doesUserMeetAudienceConditionsHandlesNullValueAttributesWithNull() {

logbackVerifier.expectMessage(Level.DEBUG,
"Starting to evaluate audience \"2196265320\" with conditions: [and, [or, [or, {name='nationality', type='custom_attribute', match='null', value='English'}, {name='nationality', type='custom_attribute', match='null', value=null}]]].");
logbackVerifier.expectMessage(Level.WARN,
logbackVerifier.expectMessage(Level.DEBUG,
"Audience condition \"{name='nationality', type='custom_attribute', match='null', value=null}\" has an unsupported condition value. You may need to upgrade to a newer release of the Optimizely SDK.");
logbackVerifier.expectMessage(Level.DEBUG,
"Audience \"2196265320\" evaluated to null.");
Expand All @@ -283,7 +283,7 @@ public void doesUserMeetAudienceConditionsHandlesNullConditionValue() {

logbackVerifier.expectMessage(Level.DEBUG,
"Starting to evaluate audience \"2196265320\" with conditions: [and, [or, [or, {name='nationality', type='custom_attribute', match='null', value='English'}, {name='nationality', type='custom_attribute', match='null', value=null}]]].");
logbackVerifier.expectMessage(Level.WARN,
logbackVerifier.expectMessage(Level.DEBUG,
"Audience condition \"{name='nationality', type='custom_attribute', match='null', value=null}\" has an unsupported condition value. You may need to upgrade to a newer release of the Optimizely SDK.");
logbackVerifier.expectMessage(Level.DEBUG,
"Audience \"2196265320\" evaluated to null.");
Expand Down