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

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

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



##########
File path: 
geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/hash/AbstractHashesIntegrationTest.java
##########
@@ -365,6 +365,28 @@ public void testHSetNXExecutor() {
 
   }
 
+  @Test
+  public void hsetNX_shouldThrowErrorIfKeyIsWrongType() {
+    String string_key = "String_Key";
+    String set_key = "Set_Key";
+    String field = "field";
+    String value = "value";
+
+    jedis.set(string_key, value);
+    jedis.sadd(set_key, field);
+
+    assertThatThrownBy(
+        () -> jedis.hsetnx(string_key, field, "something else"))
+            .isInstanceOf(JedisDataException.class)
+            .hasMessageContaining("WRONGTYPE");

Review comment:
       It would be nice if we checked the full error message here.  We store 
the rest of it as a constant in `RedisConstants`, so it could be something like:
   ```
   .hasMessage("WRONGTYPE " + ERROR_WRONG_TYPE);
   ```
   
   I know it might seem like overkill, but I remember us having problems with 
other error messages not matching Redis's exactly.  There are other tests where 
we just check that the message contains `WRONGTYPE`, maybe we could change 
those as well.




----------------------------------------------------------------
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


> Unit/Integration tests for HSETNX command
> -----------------------------------------
>
>                 Key: GEODE-8858
>                 URL: https://issues.apache.org/jira/browse/GEODE-8858
>             Project: Geode
>          Issue Type: Test
>          Components: redis
>            Reporter: Raymond Ingles
>            Priority: Major
>              Labels: pull-request-available
>
> Flesh out unit/integration tests for Redis HSETNX command.



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

Reply via email to