[ 
https://issues.apache.org/jira/browse/GEODE-8864?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17294214#comment-17294214
 ] 

ASF GitHub Bot commented on GEODE-8864:
---------------------------------------

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



##########
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:
       I think this got updated for the test below it, but not this one.
   
   the conversation wasn't propagated, so adding it here:
   ```
   you could do the following:
   
    if (entry.toString().contains("field")) {
           assertThat(keyList).contains(entry);
    } else if (entry.toString().contains("value")) {
           assertThat(keyList).doesNotContain(entry);
   }
   this will result in clearer failure messages.
   ```




----------------------------------------------------------------
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:
[email protected]


> finish implementation of Redis HScan Command
> --------------------------------------------
>
>                 Key: GEODE-8864
>                 URL: https://issues.apache.org/jira/browse/GEODE-8864
>             Project: Geode
>          Issue Type: New Feature
>          Components: redis
>            Reporter: John Hutchison
>            Priority: Major
>              Labels: blocks-1.14.0​, pull-request-available
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to