Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit d4ff9c6

Browse files
prepare 5.2.1 release (#221)
1 parent 0590a47 commit d4ff9c6

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/main/java/com/launchdarkly/sdk/server/integrations/TestData.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ private FlagBuilder(FlagBuilder from) {
225225
this.fallthroughVariation = from.fallthroughVariation;
226226
this.variations = new CopyOnWriteArrayList<>(from.variations);
227227
this.targets = from.targets == null ? null : new HashMap<>(from.targets);
228+
this.rules = from.rules == null ? null : new ArrayList<>(from.rules);
228229
}
229230

230231
private boolean isBooleanFlag() {

src/test/java/com/launchdarkly/sdk/server/integrations/TestDataTest.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,10 @@ public void addsFlag() throws Exception {
106106
@Test
107107
public void updatesFlag() throws Exception {
108108
TestData td = TestData.dataSource();
109-
td.update(td.flag("flag1").on(false));
109+
td.update(td.flag("flag1")
110+
.on(false)
111+
.variationForUser("a", true)
112+
.ifMatch(UserAttribute.NAME, LDValue.of("Lucy")).thenReturn(true));
110113

111114
DataSource ds = td.createDataSource(null, updates);
112115
Future<Void> started = ds.start();
@@ -123,6 +126,14 @@ public void updatesFlag() throws Exception {
123126
ItemDescriptor flag1 = up.item;
124127
assertThat(flag1.getVersion(), equalTo(2));
125128
assertThat(flagJson(flag1).get("on").booleanValue(), is(true));
129+
130+
String expectedJson = "{\"trackEventsFallthrough\":false,\"deleted\":false,"
131+
+ "\"variations\":[true,false],\"clientSide\":false,\"rules\":[{\"clauses\":"
132+
+ "[{\"op\":\"in\",\"negate\":false,\"values\":[\"Lucy\"],\"attribute\":\"name\"}],"
133+
+ "\"id\":\"rule0\",\"trackEvents\":false,\"variation\":0}],\"trackEvents\":false,"
134+
+ "\"fallthrough\":{\"variation\":0},\"offVariation\":1,\"version\":2,\"targets\":"
135+
+ "[{\"values\":[\"a\"],\"variation\":0}],\"key\":\"flag1\",\"on\":true}";
136+
assertThat(flagJson(flag1), equalTo(LDValue.parse(expectedJson)));
126137
}
127138

128139
@Test

0 commit comments

Comments
 (0)