@@ -44,10 +44,6 @@ public void configValuesAreMappedCorrectly() {
4444 configValues .put ("authServiceEndpoint" , "sseAuthServiceEndpoint.split.io" );
4545 configValues .put ("streamingServiceEndpoint" , "streamingServiceEndpoint.split.io" );
4646 configValues .put ("telemetryServiceEndpoint" , "telemetryServiceEndpoint.split.io" );
47- Map <String , List <String >> syncConfigMap = new HashMap <>();
48- syncConfigMap .put ("syncConfigNames" , Arrays .asList ("split1" , "split2" ));
49- syncConfigMap .put ("syncConfigPrefixes" , Arrays .asList ("split_" , "my_split_" ));
50- configValues .put ("syncConfig" , syncConfigMap );
5147 configValues .put ("impressionsMode" , "none" );
5248 configValues .put ("syncEnabled" , false );
5349 configValues .put ("userConsent" , "declined" );
@@ -73,10 +69,6 @@ public void configValuesAreMappedCorrectly() {
7369 assertEquals ("sseAuthServiceEndpoint.split.io" , splitClientConfig .authServiceUrl ());
7470 assertEquals ("streamingServiceEndpoint.split.io" , splitClientConfig .streamingServiceUrl ());
7571 assertEquals ("telemetryServiceEndpoint.split.io" , splitClientConfig .telemetryEndpoint ());
76- assertEquals (Arrays .asList ("split1" , "split2" ), splitClientConfig .syncConfig ().getFilters ().get (0 ).getValues ());
77- assertEquals (SplitFilter .Type .BY_NAME , splitClientConfig .syncConfig ().getFilters ().get (0 ).getType ());
78- assertEquals (Arrays .asList ("split_" , "my_split_" ), splitClientConfig .syncConfig ().getFilters ().get (1 ).getValues ());
79- assertEquals (SplitFilter .Type .BY_PREFIX , splitClientConfig .syncConfig ().getFilters ().get (1 ).getType ());
8072 assertEquals (ImpressionsMode .NONE , splitClientConfig .impressionsMode ());
8173 assertFalse (splitClientConfig .syncEnabled ());
8274 assertEquals (UserConsent .DECLINED , splitClientConfig .userConsent ());
@@ -151,4 +143,39 @@ public void impressionsModeValuesAreMappedCorrectly() {
151143 assertEquals (ImpressionsMode .NONE , noneConfig .impressionsMode ());
152144 assertEquals (ImpressionsMode .OPTIMIZED , optimizedConfig .impressionsMode ());
153145 }
146+
147+ @ Test
148+ public void syncConfigWithoutFlagSetsIsMappedCorrectly () {
149+ Map <String , Object > configValues = new HashMap <>();
150+ Map <String , List <String >> syncConfigMap = new HashMap <>();
151+ syncConfigMap .put ("syncConfigNames" , Arrays .asList ("split1" , "split2" ));
152+ syncConfigMap .put ("syncConfigPrefixes" , Arrays .asList ("split_" , "my_split_" ));
153+ configValues .put ("syncConfig" , syncConfigMap );
154+
155+ SplitClientConfig splitClientConfig = SplitClientConfigHelper
156+ .fromMap (configValues , mock (ImpressionListener .class ));
157+
158+ assertEquals (2 , splitClientConfig .syncConfig ().getFilters ().size ());
159+ assertEquals (Arrays .asList ("split1" , "split2" ), splitClientConfig .syncConfig ().getFilters ().get (0 ).getValues ());
160+ assertEquals (SplitFilter .Type .BY_NAME , splitClientConfig .syncConfig ().getFilters ().get (0 ).getType ());
161+ assertEquals (Arrays .asList ("split_" , "my_split_" ), splitClientConfig .syncConfig ().getFilters ().get (1 ).getValues ());
162+ assertEquals (SplitFilter .Type .BY_PREFIX , splitClientConfig .syncConfig ().getFilters ().get (1 ).getType ());
163+ }
164+
165+ @ Test
166+ public void syncConfigWithFlagSetsIsMappedCorrectly () {
167+ Map <String , Object > configValues = new HashMap <>();
168+ Map <String , List <String >> syncConfigMap = new HashMap <>();
169+ syncConfigMap .put ("syncConfigNames" , Arrays .asList ("split1" , "split2" ));
170+ syncConfigMap .put ("syncConfigPrefixes" , Arrays .asList ("split_" , "my_split_" ));
171+ syncConfigMap .put ("syncConfigFlagSets" , Arrays .asList ("set_1" , "set_2" ));
172+ configValues .put ("syncConfig" , syncConfigMap );
173+
174+ SplitClientConfig splitClientConfig = SplitClientConfigHelper
175+ .fromMap (configValues , mock (ImpressionListener .class ));
176+
177+ assertEquals (1 , splitClientConfig .syncConfig ().getFilters ().size ());
178+ assertEquals (Arrays .asList ("set_1" , "set_2" ), splitClientConfig .syncConfig ().getFilters ().get (0 ).getValues ());
179+ assertEquals (SplitFilter .Type .BY_SET , splitClientConfig .syncConfig ().getFilters ().get (0 ).getType ());
180+ }
154181}
0 commit comments