Skip to content

Commit

Permalink
fixing some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tanderson-ld committed Nov 21, 2024
1 parent 99c99a2 commit a0154a9
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class PersistentDataStoreWrapperTest extends EasyMockSupport {
private static final String CONTEXT_KEY_HASH = LDUtil.urlSafeBase64Hash(CONTEXT_KEY);
private static final String CONTEXT_FINGERPRINT = "mock-context-fingerprint";
private static final String EXPECTED_CONTEXT_FLAGS_KEY = "flags_" + CONTEXT_KEY_HASH;
private static final String EXPECTED_CONTEXT_FINGERPRINT_KEY = "contextFingerprint_" + CONTEXT_KEY_HASH;
private static final String EXPECTED_INDEX_KEY = "index";
private static final String EXPECTED_GENERATED_CONTEXT_KEY_PREFIX = "anonKey_";
private static final Flag FLAG = new Flag("flagkey", LDValue.of(true), 1,
Expand Down Expand Up @@ -101,6 +102,8 @@ public void setContextData() {
EnvironmentData data = new DataSetBuilder().add(FLAG).build();
mockPersistentStore.setValue(EXPECTED_ENVIRONMENT_NAMESPACE,
EXPECTED_CONTEXT_FLAGS_KEY, data.toJson());
mockPersistentStore.setValue(EXPECTED_ENVIRONMENT_NAMESPACE,
EXPECTED_CONTEXT_FINGERPRINT_KEY, CONTEXT_FINGERPRINT);
expectLastCall();
replayAll();

Expand All @@ -114,6 +117,8 @@ public void setContextDataWhenStoreThrowsException() {
EnvironmentData data = new DataSetBuilder().add(FLAG).build();
mockPersistentStore.setValue(EXPECTED_ENVIRONMENT_NAMESPACE,
EXPECTED_CONTEXT_FLAGS_KEY, data.toJson());
mockPersistentStore.setValue(EXPECTED_ENVIRONMENT_NAMESPACE,
EXPECTED_CONTEXT_FINGERPRINT_KEY, CONTEXT_FINGERPRINT);
expectLastCall().andThrow(makeException());
replayAll();

Expand All @@ -125,6 +130,7 @@ public void setContextDataWhenStoreThrowsException() {
@Test
public void removeContextData() {
mockPersistentStore.setValue(EXPECTED_ENVIRONMENT_NAMESPACE, EXPECTED_CONTEXT_FLAGS_KEY, null);
mockPersistentStore.setValue(EXPECTED_ENVIRONMENT_NAMESPACE, EXPECTED_CONTEXT_FINGERPRINT_KEY, null);
expectLastCall();
replayAll();

Expand All @@ -136,6 +142,7 @@ public void removeContextData() {
@Test
public void removeContextDataWhenStoreThrowsException() {
mockPersistentStore.setValue(EXPECTED_ENVIRONMENT_NAMESPACE, EXPECTED_CONTEXT_FLAGS_KEY, null);
mockPersistentStore.setValue(EXPECTED_ENVIRONMENT_NAMESPACE, EXPECTED_CONTEXT_FINGERPRINT_KEY, null);
expectLastCall().andThrow(makeException());
replayAll();

Expand Down

0 comments on commit a0154a9

Please sign in to comment.