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

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

jdeppe-pivotal commented on a change in pull request #5940:
URL: https://github.com/apache/geode/pull/5940#discussion_r562907161



##########
File path: 
geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/hash/AbstractHashesIntegrationTest.java
##########
@@ -365,6 +365,40 @@ 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");
+    assertThatThrownBy(
+        () -> jedis.hsetnx(set_key, field, "something 
else")).isInstanceOf(JedisDataException.class)
+            .hasMessageContaining("WRONGTYPE");
+
+    jedis.del(string_key);
+    jedis.del(set_key);
+  }
+
+  @Test
+  public void hsetnx_shouldThrowError_givenWrongNumberOfArguments() {
+    assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.HSETNX))
+        .hasMessageContaining("wrong number of arguments");
+    assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.HSETNX, "1"))
+        .hasMessageContaining("wrong number of arguments");
+    assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.HSETNX, "1", 
"2"))
+        .hasMessageContaining("wrong number of arguments");
+    assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.HSETNX, "1", 
"2", "3", "4"))
+        .hasMessageContaining("wrong number of arguments");
+  }

Review comment:
       I've already made these changes in another PR.




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


> 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