Skip to content

Commit c59db87

Browse files
Update managed value test to use conditional values
Updated `testGetTemplateWithManagedValues` in `FirebaseRemoteConfigTest` to set managed values (Rollout, Personalization) as conditional values instead of default values, as they are not supported as default values.
1 parent baf8e01 commit c59db87

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/test/java/com/google/firebase/remoteconfig/FirebaseRemoteConfigTest.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,10 @@ public void testGetTemplateWithManagedValues() throws FirebaseRemoteConfigExcept
155155
Template template = new Template()
156156
.setETag(TEST_ETAG)
157157
.setParameters(ImmutableMap.of(
158-
"p1", new Parameter().setDefaultValue(
159-
ParameterValue.ofRollout("rollout_1", "value_1", 10.0)),
160-
"p2", new Parameter().setDefaultValue(
161-
ParameterValue.ofPersonalization("personalization_1"))
158+
"p1", new Parameter().setConditionalValues(ImmutableMap.of(
159+
"c1", ParameterValue.ofRollout("rollout_1", "value_1", 10.0))),
160+
"p2", new Parameter().setConditionalValues(ImmutableMap.of(
161+
"c2", ParameterValue.ofPersonalization("personalization_1")))
162162
));
163163
MockRemoteConfigClient client = MockRemoteConfigClient.fromTemplate(template);
164164
FirebaseRemoteConfig remoteConfig = getRemoteConfig(client);
@@ -167,13 +167,15 @@ public void testGetTemplateWithManagedValues() throws FirebaseRemoteConfigExcept
167167

168168
assertEquals(TEST_ETAG, fetchedTemplate.getETag());
169169
ParameterValue.RolloutValue rolloutValue =
170-
(ParameterValue.RolloutValue) fetchedTemplate.getParameters().get("p1").getDefaultValue();
170+
(ParameterValue.RolloutValue) fetchedTemplate.getParameters().get("p1")
171+
.getConditionalValues().get("c1");
171172
assertEquals("rollout_1", rolloutValue.getRolloutId());
172173
assertEquals("value_1", rolloutValue.getValue());
173174
assertEquals(10.0, rolloutValue.getPercent(), 0.0);
174175

175176
ParameterValue.PersonalizationValue personalizationValue =
176-
(ParameterValue.PersonalizationValue) fetchedTemplate.getParameters().get("p2").getDefaultValue();
177+
(ParameterValue.PersonalizationValue) fetchedTemplate.getParameters().get("p2")
178+
.getConditionalValues().get("c2");
177179
assertEquals("personalization_1", personalizationValue.getPersonalizationId());
178180
}
179181

0 commit comments

Comments
 (0)