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

Commit a805874

Browse files
committed
Ensure that the custom map is not null.
1 parent 9da4571 commit a805874

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

src/main/java/com/launchdarkly/client/LDUser.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public LDUser(Builder builder) {
5555
*/
5656
public LDUser(String key) {
5757
this.key = key;
58+
this.custom = new HashMap<String, JsonElement>();
5859
}
5960

6061
String getKey() {

src/test/java/com/launchdarkly/client/FeatureRepTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,13 @@ public void testDisabledFlagAlwaysOff() {
8989
assertEquals(null, b);
9090
}
9191

92+
@Test
93+
public void testFlagWithCustomAttributeWorksWithLDUserDefaultCtor() {
94+
LDUser user = new LDUser("randomUser@test.com");
95+
96+
Boolean b = simpleFlag.evaluate(user);
97+
98+
assertNotNull(b);
99+
}
100+
92101
}

src/test/java/com/launchdarkly/client/LDUserTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,5 @@ public void testLDUserJsonSerializationContainsCountryAsTwoDigitCode() {
6565

6666
assert(deserialized.getCountry().equals(LDCountryCode.US));
6767
}
68+
6869
}

0 commit comments

Comments
 (0)