44import com .google .common .collect .Sets ;
55import io .split .client .dtos .ConditionType ;
66import io .split .client .dtos .MatcherCombiner ;
7+ import io .split .client .dtos .SplitChange ;
8+ import io .split .client .utils .Json ;
9+ import io .split .client .utils .RuleBasedSegmentsToUpdate ;
710import io .split .engine .matchers .AttributeMatcher ;
811import io .split .engine .matchers .CombiningMatcher ;
912import io .split .engine .matchers .UserDefinedSegmentMatcher ;
1013
1114import org .junit .Assert ;
1215import org .junit .Test ;
1316
17+ import java .util .ArrayList ;
18+
19+ import static io .split .client .utils .RuleBasedSegmentProcessor .processRuleBasedSegmentChanges ;
20+
1421public class ParsedRuleBasedSegmentTest {
1522
1623 @ Test
@@ -27,4 +34,17 @@ public void works() {
2734 parsedRuleBasedSegment .parsedConditions ());
2835 Assert .assertEquals (123 , parsedRuleBasedSegment .changeNumber ());
2936 }
37+
38+ @ Test
39+ public void worksWithoutExcluded () {
40+ RuleBasedSegmentParser parser = new RuleBasedSegmentParser ();
41+ String load = "{\" ff\" :{\" s\" :-1,\" t\" :-1,\" d\" :[]},\" rbs\" :{\" s\" :-1,\" t\" :1457726098069,\" d\" :[{ \" changeNumber\" : 123, \" trafficTypeName\" : \" user\" , \" name\" : \" some_name\" ,"
42+ + "\" status\" : \" ACTIVE\" ,\" conditions\" : [{\" contitionType\" : \" ROLLOUT\" ,"
43+ + "\" label\" : \" some_label\" , \" matcherGroup\" : { \" matchers\" : [{ \" matcherType\" : \" ALL_KEYS\" , \" negate\" : false}],"
44+ + "\" combiner\" : \" AND\" }}]}]}}" ;
45+ SplitChange change = Json .fromJson (load , SplitChange .class );
46+ RuleBasedSegmentsToUpdate toUpdate = processRuleBasedSegmentChanges (parser , change .ruleBasedSegments .d );
47+ Assert .assertEquals (new ArrayList <>(), toUpdate .getToAdd ().get (0 ).excludedKeys ());
48+ Assert .assertEquals (new ArrayList <>(), toUpdate .getToAdd ().get (0 ).excludedSegments ());
49+ }
3050}
0 commit comments