Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions testing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
</parent>
<artifactId>java-client-testing</artifactId>
<packaging>jar</packaging>
<version>4.18.3</version>
<version>5.0.0</version>
<name>Java Client For Testing</name>
<description>Testing suite for Java SDK for Split</description>
<dependencies>
<dependency>
<groupId>io.split.client</groupId>
<artifactId>java-client</artifactId>
<version>${project.version}</version>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,8 @@ public SplitClientForTest() {
_tests = new HashMap<>();
}

public Map<String, String> tests() {
return _tests
.entrySet()
.stream()
.collect(toMap(
entry -> entry.getKey().split(),
entry -> entry.getValue().treatment(),
(existing, replacement) -> existing
));
}

public Map<SplitAndKey, SplitResult> testMappings() {
return Collections.unmodifiableMap(_tests);
public Map<SplitAndKey, SplitResult> tests() {
return _tests;
}

public void clearTreatments() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void evaluate() throws Throwable {
SplitClientForTest splitClient = findFirstSplitClient(target, target.getClass());

// Preserve the Split state between Test runs
Map<SplitAndKey, SplitResult> priorTests = new HashMap<>(splitClient.testMappings());
Map<SplitAndKey, SplitResult> priorTests = new HashMap<>(splitClient.tests());

// Apply the Active Scenario for this
if (scenario != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.split.client.testing;

import com.google.common.collect.ImmutableMap;
import io.split.client.api.Key;
import io.split.client.api.SplitResult;
import io.split.client.dtos.EvaluationOptions;
Expand All @@ -15,6 +14,7 @@
import org.junit.runner.RunWith;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Objects;

Expand Down Expand Up @@ -97,11 +97,11 @@ public void testDefaultScenario() {
Assert.assertEquals(new SplitResult(ON_TREATMENT, null), splitClient.getTreatmentWithConfig(ARBITRARY_KEY, DEFAULT_CLIENT_FEATURE, new HashMap<>(), new EvaluationOptions(new HashMap<>())));
Assert.assertEquals(new SplitResult(ON_TREATMENT, null), splitClient.getTreatmentWithConfig(ARBITRARY_KEY, DEFAULT_CLIENT_FEATURE, new EvaluationOptions(new HashMap<>())));
Assert.assertEquals(new SplitResult(ON_TREATMENT, null), splitClient.getTreatmentWithConfig(new Key(ARBITRARY_KEY, ARBITRARY_KEY), DEFAULT_CLIENT_FEATURE, new HashMap<>(), new EvaluationOptions(new HashMap<>())));
Assert.assertEquals(ImmutableMap.of(DEFAULT_CLIENT_FEATURE, ON_TREATMENT), splitClient.getTreatments(ARBITRARY_KEY, Arrays.asList(DEFAULT_CLIENT_FEATURE), new EvaluationOptions(new HashMap<>())));
Assert.assertEquals(ImmutableMap.of(DEFAULT_CLIENT_FEATURE, ON_TREATMENT), splitClient.getTreatments(ARBITRARY_KEY, Arrays.asList(DEFAULT_CLIENT_FEATURE), new HashMap<>(), new EvaluationOptions(new HashMap<>())));
Assert.assertEquals(ImmutableMap.of(DEFAULT_CLIENT_FEATURE, new SplitResult(ON_TREATMENT, null)), splitClient.getTreatmentsWithConfig(ARBITRARY_KEY, Arrays.asList(DEFAULT_CLIENT_FEATURE), new EvaluationOptions(new HashMap<>())));
Assert.assertEquals(Collections.singletonMap(DEFAULT_CLIENT_FEATURE, ON_TREATMENT), splitClient.getTreatments(ARBITRARY_KEY, Arrays.asList(DEFAULT_CLIENT_FEATURE), new EvaluationOptions(new HashMap<>())));
Assert.assertEquals(Collections.singletonMap(DEFAULT_CLIENT_FEATURE, ON_TREATMENT), splitClient.getTreatments(ARBITRARY_KEY, Arrays.asList(DEFAULT_CLIENT_FEATURE), new HashMap<>(), new EvaluationOptions(new HashMap<>())));
Assert.assertEquals(Collections.singletonMap(DEFAULT_CLIENT_FEATURE, new SplitResult(ON_TREATMENT, null)), splitClient.getTreatmentsWithConfig(ARBITRARY_KEY, Arrays.asList(DEFAULT_CLIENT_FEATURE), new EvaluationOptions(new HashMap<>())));
Assert.assertEquals(new SplitResult(ON_TREATMENT, null), splitClient.getTreatmentsWithConfig(ARBITRARY_KEY, Arrays.asList(DEFAULT_CLIENT_FEATURE), new HashMap<>(), new EvaluationOptions(new HashMap<>())).get(DEFAULT_CLIENT_FEATURE));
Assert.assertEquals(ImmutableMap.of(DEFAULT_CLIENT_FEATURE, new SplitResult(ON_TREATMENT, null)), splitClient.getTreatmentsWithConfig(new Key(ARBITRARY_KEY, ARBITRARY_KEY), Arrays.asList(DEFAULT_CLIENT_FEATURE), new HashMap<>(), new EvaluationOptions(new HashMap<>())));
Assert.assertEquals(Collections.singletonMap(DEFAULT_CLIENT_FEATURE, new SplitResult(ON_TREATMENT, null)), splitClient.getTreatmentsWithConfig(new Key(ARBITRARY_KEY, ARBITRARY_KEY), Arrays.asList(DEFAULT_CLIENT_FEATURE), new HashMap<>(), new EvaluationOptions(new HashMap<>())));

Assert.assertEquals(new HashMap<>(), splitClient.getTreatmentsByFlagSet(ARBITRARY_KEY, "flagset", new HashMap<>(), new EvaluationOptions(new HashMap<>())));
Assert.assertEquals(new HashMap<>(), splitClient.getTreatmentsByFlagSet(ARBITRARY_KEY, "flagset", new EvaluationOptions(new HashMap<>())));
Expand Down