Skip to content

Commit

Permalink
Add some test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
nmayorsplit committed Dec 1, 2023
1 parent bfc3547 commit 5424970
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.split.client</groupId>
<artifactId>java-client-parent</artifactId>
<version>4.10.2-rc2</version>
<version>4.10.2</version>
</parent>
<artifactId>java-client</artifactId>
<packaging>jar</packaging>
Expand Down
7 changes: 4 additions & 3 deletions client/src/main/java/io/split/client/SplitClientImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public final class SplitClientImpl implements SplitClient {
public static final SplitResult SPLIT_RESULT_CONTROL = new SplitResult(Treatments.CONTROL, null);
private static final String CLIENT_DESTROY = "Client has already been destroyed - no calls possible";
private static final String CATCHALL_EXCEPTION = "CatchAll Exception";
private static final String MATCHING_KEY = "matchingKey";

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

Expand Down Expand Up @@ -321,7 +322,7 @@ private SplitResult getTreatmentWithConfigInternal(String matchingKey, String bu
return SPLIT_RESULT_CONTROL;
}

if (!KeyValidator.isValid(matchingKey, "matchingKey", _config.maxStringLength(), methodEnum.getMethod())) {
if (!KeyValidator.isValid(matchingKey, MATCHING_KEY, _config.maxStringLength(), methodEnum.getMethod())) {
return SPLIT_RESULT_CONTROL;
}

Expand Down Expand Up @@ -462,7 +463,7 @@ private Map<String, SplitResult> validateBeforeEvaluateByFlagSets(String matchin
_log.error(CLIENT_DESTROY);
return new HashMap<>();
}
if (!KeyValidator.isValid(matchingKey, "matchingKey", _config.maxStringLength(), methodEnum.getMethod())) {
if (!KeyValidator.isValid(matchingKey, MATCHING_KEY, _config.maxStringLength(), methodEnum.getMethod())) {
return new HashMap<>();
}
if (!KeyValidator.bucketingKeyIsValid(bucketingKey, _config.maxStringLength(), methodEnum.getMethod())) {
Expand All @@ -476,7 +477,7 @@ private Map<String, SplitResult> validateBeforeEvaluate(List<String> featureFlag
_log.error(CLIENT_DESTROY);
return createMapControl(featureFlagNames);
}
if (!KeyValidator.isValid(matchingKey, "matchingKey", _config.maxStringLength(), methodEnum.getMethod())) {
if (!KeyValidator.isValid(matchingKey, MATCHING_KEY, _config.maxStringLength(), methodEnum.getMethod())) {
return createMapControl(featureFlagNames);
}
if (!KeyValidator.bucketingKeyIsValid(bucketingKey, _config.maxStringLength(), methodEnum.getMethod())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
Expand Down Expand Up @@ -236,5 +237,9 @@ public void testGetNamesByFlagSets() {
_cache.remove("splitName_2");
namesByFlagSets = _cache.getNamesByFlagSets(new ArrayList<>(Arrays.asList("set1", "set2", "set3")));
assertFalse(namesByFlagSets.get("set1").contains("splitName_2"));
_cache.remove("splitName_1");
namesByFlagSets = _cache.getNamesByFlagSets(new ArrayList<>(Arrays.asList("set1", "set2", "set3")));
assertFalse(namesByFlagSets.get("set1").contains("splitName_1"));
assertTrue(namesByFlagSets.get("set1").isEmpty());
}
}
2 changes: 1 addition & 1 deletion pluggable-storage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>java-client-parent</artifactId>
<groupId>io.split.client</groupId>
<version>4.10.2-rc2</version>
<version>4.10.2</version>
</parent>

<version>2.1.0</version>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.split.client</groupId>
<artifactId>java-client-parent</artifactId>
<version>4.10.2-rc2</version>
<version>4.10.2</version>
<dependencyManagement>
<dependencies>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion redis-wrapper/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>java-client-parent</artifactId>
<groupId>io.split.client</groupId>
<version>4.10.2-rc2</version>
<version>4.10.2</version>
</parent>
<artifactId>redis-wrapper</artifactId>
<version>3.1.0</version>
Expand Down
2 changes: 1 addition & 1 deletion testing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.split.client</groupId>
<artifactId>java-client-parent</artifactId>
<version>4.10.2-rc2</version>
<version>4.10.2</version>
</parent>
<artifactId>java-client-testing</artifactId>
<packaging>jar</packaging>
Expand Down

0 comments on commit 5424970

Please sign in to comment.