Skip to content

Commit 5424970

Browse files
committed
Add some test cases
1 parent bfc3547 commit 5424970

File tree

7 files changed

+14
-8
lines changed

7 files changed

+14
-8
lines changed

client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>io.split.client</groupId>
77
<artifactId>java-client-parent</artifactId>
8-
<version>4.10.2-rc2</version>
8+
<version>4.10.2</version>
99
</parent>
1010
<artifactId>java-client</artifactId>
1111
<packaging>jar</packaging>

client/src/main/java/io/split/client/SplitClientImpl.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public final class SplitClientImpl implements SplitClient {
4848
public static final SplitResult SPLIT_RESULT_CONTROL = new SplitResult(Treatments.CONTROL, null);
4949
private static final String CLIENT_DESTROY = "Client has already been destroyed - no calls possible";
5050
private static final String CATCHALL_EXCEPTION = "CatchAll Exception";
51+
private static final String MATCHING_KEY = "matchingKey";
5152

5253
private static final Logger _log = LoggerFactory.getLogger(SplitClientImpl.class);
5354

@@ -321,7 +322,7 @@ private SplitResult getTreatmentWithConfigInternal(String matchingKey, String bu
321322
return SPLIT_RESULT_CONTROL;
322323
}
323324

324-
if (!KeyValidator.isValid(matchingKey, "matchingKey", _config.maxStringLength(), methodEnum.getMethod())) {
325+
if (!KeyValidator.isValid(matchingKey, MATCHING_KEY, _config.maxStringLength(), methodEnum.getMethod())) {
325326
return SPLIT_RESULT_CONTROL;
326327
}
327328

@@ -462,7 +463,7 @@ private Map<String, SplitResult> validateBeforeEvaluateByFlagSets(String matchin
462463
_log.error(CLIENT_DESTROY);
463464
return new HashMap<>();
464465
}
465-
if (!KeyValidator.isValid(matchingKey, "matchingKey", _config.maxStringLength(), methodEnum.getMethod())) {
466+
if (!KeyValidator.isValid(matchingKey, MATCHING_KEY, _config.maxStringLength(), methodEnum.getMethod())) {
466467
return new HashMap<>();
467468
}
468469
if (!KeyValidator.bucketingKeyIsValid(bucketingKey, _config.maxStringLength(), methodEnum.getMethod())) {
@@ -476,7 +477,7 @@ private Map<String, SplitResult> validateBeforeEvaluate(List<String> featureFlag
476477
_log.error(CLIENT_DESTROY);
477478
return createMapControl(featureFlagNames);
478479
}
479-
if (!KeyValidator.isValid(matchingKey, "matchingKey", _config.maxStringLength(), methodEnum.getMethod())) {
480+
if (!KeyValidator.isValid(matchingKey, MATCHING_KEY, _config.maxStringLength(), methodEnum.getMethod())) {
480481
return createMapControl(featureFlagNames);
481482
}
482483
if (!KeyValidator.bucketingKeyIsValid(bucketingKey, _config.maxStringLength(), methodEnum.getMethod())) {

client/src/test/java/io/split/storages/memory/InMemoryCacheTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.util.stream.Collectors;
2424
import java.util.stream.Stream;
2525

26+
import static org.junit.Assert.assertEquals;
2627
import static org.junit.Assert.assertFalse;
2728
import static org.junit.Assert.assertNull;
2829
import static org.junit.Assert.assertTrue;
@@ -236,5 +237,9 @@ public void testGetNamesByFlagSets() {
236237
_cache.remove("splitName_2");
237238
namesByFlagSets = _cache.getNamesByFlagSets(new ArrayList<>(Arrays.asList("set1", "set2", "set3")));
238239
assertFalse(namesByFlagSets.get("set1").contains("splitName_2"));
240+
_cache.remove("splitName_1");
241+
namesByFlagSets = _cache.getNamesByFlagSets(new ArrayList<>(Arrays.asList("set1", "set2", "set3")));
242+
assertFalse(namesByFlagSets.get("set1").contains("splitName_1"));
243+
assertTrue(namesByFlagSets.get("set1").isEmpty());
239244
}
240245
}

pluggable-storage/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<artifactId>java-client-parent</artifactId>
88
<groupId>io.split.client</groupId>
9-
<version>4.10.2-rc2</version>
9+
<version>4.10.2</version>
1010
</parent>
1111

1212
<version>2.1.0</version>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>io.split.client</groupId>
66
<artifactId>java-client-parent</artifactId>
7-
<version>4.10.2-rc2</version>
7+
<version>4.10.2</version>
88
<dependencyManagement>
99
<dependencies>
1010
<dependency>

redis-wrapper/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<artifactId>java-client-parent</artifactId>
88
<groupId>io.split.client</groupId>
9-
<version>4.10.2-rc2</version>
9+
<version>4.10.2</version>
1010
</parent>
1111
<artifactId>redis-wrapper</artifactId>
1212
<version>3.1.0</version>

testing/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>io.split.client</groupId>
77
<artifactId>java-client-parent</artifactId>
8-
<version>4.10.2-rc2</version>
8+
<version>4.10.2</version>
99
</parent>
1010
<artifactId>java-client-testing</artifactId>
1111
<packaging>jar</packaging>

0 commit comments

Comments
 (0)