jhutchison commented on a change in pull request #5954:
URL: https://github.com/apache/geode/pull/5954#discussion_r585111819



##########
File path: 
geode-redis/src/test/java/org/apache/geode/redis/internal/data/RedisHashTest.java
##########
@@ -161,4 +163,109 @@ public void 
setExpirationTimestamp_stores_delta_that_is_stable() throws IOExcept
     o2.fromDelta(in);
     assertThat(o2).isEqualTo(o1);
   }
+
+  @Test
+  public void hscanSnaphots_shouldBeEmpty_givenHscanHasNotBeenCalled() {
+    RedisHash subject = createRedisHash(100);
+    assertThat(subject.getHscanSnapShots()).isEmpty();
+  }
+
+  @Test
+  public void hscanSnaphots_shouldContainSnapshot_givenHscanHasBeenCalled() {
+
+    final List<ByteArrayWrapper> FIELDS_AND_VALUES_FOR_HASH = 
createListOfDataElements(100);
+    RedisHash subject = new RedisHash(FIELDS_AND_VALUES_FOR_HASH);
+    UUID clientID = UUID.randomUUID();
+
+    subject.hscan(clientID, null, 10, BigInteger.valueOf(0));
+
+    ConcurrentHashMap<UUID, List<ByteArrayWrapper>> hscanSnapShotMap = 
subject.getHscanSnapShots();
+
+    assertThat(hscanSnapShotMap.containsKey(clientID)).isTrue();
+
+    List<ByteArrayWrapper> keyList = hscanSnapShotMap.get(clientID);
+    assertThat(keyList).isNotEmpty();
+
+    FIELDS_AND_VALUES_FOR_HASH.forEach((entry) -> {
+      if (entry.toString().contains("field")) {
+        assertThat(keyList.contains(entry)).isTrue();
+      } else if (entry.toString().contains("value")) {
+        assertThat(keyList.contains(entry)).isFalse();

Review comment:
       thanks




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to