This is an automated email from the ASF dual-hosted git repository.
jensdeppe pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/develop by this push:
new 8a5a3e0 GEODE-8938: add test helper for command arguments (#6031)
8a5a3e0 is described below
commit 8a5a3e0f9c1f83f915b5a9547187977628cf1c01
Author: Hale Bales <[email protected]>
AuthorDate: Tue Feb 16 06:55:32 2021 -0800
GEODE-8938: add test helper for command arguments (#6031)
---
.../redis/RedisCommandArgumentsTestHelper.java | 68 ++++++++++++++++++
.../connection/AbstractEchoIntegrationTest.java | 13 +---
.../connection/AbstractPingIntegrationTest.java | 9 ++-
.../connection/AbstractSelectIntegrationTest.java | 13 +---
.../hash/AbstractHashesIntegrationTest.java | 80 +++++-----------------
.../hash/AbstractHincrByFloatIntegrationTest.java | 25 +------
.../executor/key/AbstractDelIntegrationTest.java | 7 +-
.../key/AbstractExistsIntegrationTest.java | 7 +-
.../key/AbstractExpireAtIntegrationTest.java | 18 +----
.../key/AbstractExpireIntegrationTest.java | 18 +----
.../executor/key/AbstractKeysIntegrationTest.java | 13 +---
.../key/AbstractPExpireAtIntegrationTest.java | 18 +----
.../executor/key/AbstractPTTLIntegrationTest.java | 18 +----
.../key/AbstractPersistIntegrationTest.java | 13 +---
.../key/AbstractPexpireIntegrationTest.java | 18 +----
.../key/AbstractRenameIntegrationTest.java | 13 +---
.../executor/key/AbstractTTLIntegrationTest.java | 13 +---
.../executor/key/AbstractTypeIntegrationTest.java | 13 +---
.../key/AbstractUnlinkIntegrationTest.java | 7 +-
.../server/AbstractTimeIntegrationTest.java | 5 +-
.../executor/set/AbstractSDiffIntegrationTest.java | 17 ++---
.../set/AbstractSInterIntegrationTest.java | 17 ++---
.../set/AbstractSIsMemberIntegrationTest.java | 20 +-----
.../executor/set/AbstractSMoveIntegrationTest.java | 25 +------
.../executor/set/AbstractSRemIntegrationTest.java | 12 +---
.../set/AbstractSUnionIntegrationTest.java | 17 ++---
.../executor/set/AbstractSetsIntegrationTest.java | 24 ++-----
.../string/AbstractBitCountIntegrationTest.java | 6 +-
.../string/AbstractBitOpIntegrationTest.java | 18 +----
.../string/AbstractBitPosIntegrationTest.java | 12 +---
.../string/AbstractDecrByIntegrationTest.java | 18 +----
.../string/AbstractDecrIntegrationTest.java | 13 +---
.../string/AbstractGetBitIntegrationTest.java | 18 +----
.../string/AbstractGetIntegrationTest.java | 12 +---
.../string/AbstractGetRangeIntegrationTest.java | 25 +------
.../string/AbstractGetSetIntegrationTest.java | 18 +----
.../string/AbstractIncrByFloatIntegrationTest.java | 19 +----
.../string/AbstractIncrByIntegrationTest.java | 19 +----
.../string/AbstractIncrIntegrationTest.java | 12 +---
.../string/AbstractMGetIntegrationTest.java | 7 +-
.../string/AbstractPSetEXIntegrationTest.java | 26 +------
.../string/AbstractSetBitIntegrationTest.java | 18 +----
.../string/AbstractSetEXIntegrationTest.java | 18 +----
.../string/AbstractSetRangeIntegrationTest.java | 25 +------
.../string/AbstractStringIntegrationTest.java | 17 ++---
45 files changed, 224 insertions(+), 598 deletions(-)
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/RedisCommandArgumentsTestHelper.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/RedisCommandArgumentsTestHelper.java
new file mode 100644
index 0000000..cf9761c
--- /dev/null
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/RedisCommandArgumentsTestHelper.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express
+ * or implied. See the License for the specific language governing permissions
and limitations under
+ * the License.
+ */
+
+package org.apache.geode.redis;
+
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+import redis.clients.jedis.Jedis;
+import redis.clients.jedis.Protocol;
+
+public class RedisCommandArgumentsTestHelper {
+ public static void assertExactNumberOfArgs(Jedis jedis, Protocol.Command
command, int numArgs) {
+ final int MAX_NUM_ARGS = 5; // currently enough for all implemented
commands
+
+ for (int i = 0; i <= MAX_NUM_ARGS; i++) {
+ if (i != numArgs) {
+ byte[][] args = buildArgs(i);
+ assertThatThrownBy(() -> jedis.sendCommand(command, args))
+ .hasMessageContaining("ERR wrong number of arguments for '"
+ + command.toString().toLowerCase() + "' command");
+ }
+ }
+ }
+
+ public static void assertAtLeastNArgs(Jedis jedis, Protocol.Command command,
int minNumArgs) {
+ for (int i = 0; i < minNumArgs; i++) {
+ byte[][] args = buildArgs(i);
+ assertThatThrownBy(() -> jedis.sendCommand(command, args))
+ .hasMessageContaining("ERR wrong number of arguments for '"
+ + command.toString().toLowerCase() + "' command");
+ }
+ }
+
+ public static void assertAtMostNArgs(Jedis jedis, Protocol.Command command,
int maxNumArgs) {
+ for (int i = maxNumArgs + 1; i <= 5; i++) {
+ byte[][] args = buildArgs(i);
+ assertThatThrownBy(() -> jedis.sendCommand(command, args))
+ .hasMessageContaining("ERR wrong number of arguments for '"
+ + command.toString().toLowerCase() + "' command");
+ }
+ }
+
+ private static byte[][] buildArgs(int numArgs) {
+ byte[][] args = new byte[numArgs][];
+
+ if (numArgs == 0) {
+ return args;
+ }
+
+ for (int i = 0; i < numArgs; i++) {
+ args[i] = String.valueOf(i).getBytes();
+ }
+
+ return args;
+ }
+}
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/connection/AbstractEchoIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/connection/AbstractEchoIntegrationTest.java
index c0c13f8..60610ba 100644
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/connection/AbstractEchoIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/connection/AbstractEchoIntegrationTest.java
@@ -16,7 +16,7 @@
package org.apache.geode.redis.internal.executor.connection;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import org.junit.After;
import org.junit.Before;
@@ -44,14 +44,7 @@ public abstract class AbstractEchoIntegrationTest implements
RedisPortSupplier {
}
@Test
- public void givenLessThanTwoArguments_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.ECHO))
- .hasMessageContaining("ERR wrong number of arguments for 'echo'
command");
- }
-
- @Test
- public void givenMoreThanTwoArguments_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.ECHO,
"hello!", "extraArg"))
- .hasMessageContaining("ERR wrong number of arguments for 'echo'
command");
+ public void errors_GivenWrongNumberOfArguments() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.ECHO, 1);
}
}
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/connection/AbstractPingIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/connection/AbstractPingIntegrationTest.java
index 970134c..3322755 100644
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/connection/AbstractPingIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/connection/AbstractPingIntegrationTest.java
@@ -16,14 +16,14 @@
package org.apache.geode.redis.internal.executor.connection;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertAtMostNArgs;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static redis.clients.jedis.Protocol.Command.PING;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import redis.clients.jedis.Jedis;
+import redis.clients.jedis.Protocol;
import org.apache.geode.test.awaitility.GeodeAwaitility;
import org.apache.geode.test.dunit.rules.RedisPortSupplier;
@@ -68,8 +68,7 @@ public abstract class AbstractPingIntegrationTest implements
RedisPortSupplier {
}
@Test
- public void ping_withTwoArgs_fails() {
- assertThatThrownBy(() -> jedis.sendCommand(PING, "one", "two"))
- .hasMessageContaining("ERR wrong number of arguments for 'ping'
command");
+ public void errors_GivenTooManyArguments() {
+ assertAtMostNArgs(jedis, Protocol.Command.PING, 1);
}
}
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/connection/AbstractSelectIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/connection/AbstractSelectIntegrationTest.java
index e73ac2a..4603552 100644
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/connection/AbstractSelectIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/connection/AbstractSelectIntegrationTest.java
@@ -16,8 +16,8 @@
package org.apache.geode.redis.internal.executor.connection;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
import org.junit.After;
import org.junit.Before;
@@ -45,15 +45,8 @@ public abstract class AbstractSelectIntegrationTest
implements RedisPortSupplier
}
@Test
- public void givenLessThanTwoArguments_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SELECT))
- .hasMessage("ERR wrong number of arguments for 'select' command");
- }
-
- @Test
- public void givenMoreThanTwoArguments_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SELECT,
"notALong", "extraArg"))
- .hasMessage("ERR wrong number of arguments for 'select' command");
+ public void errors_GivenWrongNumberOfArguments() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.SELECT, 1);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/hash/AbstractHashesIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/hash/AbstractHashesIntegrationTest.java
index 12d4e56..7d53bd4 100755
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/hash/AbstractHashesIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/hash/AbstractHashesIntegrationTest.java
@@ -14,6 +14,8 @@
*/
package org.apache.geode.redis.internal.executor.hash;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertAtLeastNArgs;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -91,7 +93,7 @@ public abstract class AbstractHashesIntegrationTest
implements RedisPortSupplier
@Test
public void testHGetall_givenWrongNumberOfArguments() {
- assertExactNumberOfArgs(Protocol.Command.HGETALL, 1);
+ assertExactNumberOfArgs(jedis, Protocol.Command.HGETALL, 1);
}
@Test
@@ -211,10 +213,7 @@ public abstract class AbstractHashesIntegrationTest
implements RedisPortSupplier
@Test
public void testHMGet_givenTooFewArguments() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.HMGET))
- .hasMessage("ERR wrong number of arguments for 'hmget' command");
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.HMGET, "1"))
- .hasMessage("ERR wrong number of arguments for 'hmget' command");
+ assertAtLeastNArgs(jedis, Protocol.Command.HMGET, 2);
}
@Test
@@ -239,11 +238,8 @@ public abstract class AbstractHashesIntegrationTest
implements RedisPortSupplier
}
@Test
- public void testHdelErrorMessage_givenIncorrectArguments() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.HDEL))
- .hasMessage("ERR wrong number of arguments for 'hdel' command");
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.HDEL, "a"))
- .hasMessage("ERR wrong number of arguments for 'hdel' command");
+ public void testHdelErrorMessage_givenTooFewArguments() {
+ assertAtLeastNArgs(jedis, Protocol.Command.HDEL, 2);
}
@Test
@@ -277,15 +273,12 @@ public abstract class AbstractHashesIntegrationTest
implements RedisPortSupplier
@Test
public void testHStrlen_givenWrongNumberOfArguments() {
- assertExactNumberOfArgs(Protocol.Command.HSTRLEN, 2);
+ assertExactNumberOfArgs(jedis, Protocol.Command.HSTRLEN, 2);
}
@Test
public void testHKeys_givenWrongNumberOfArguments() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.HKEYS))
- .hasMessageContaining("ERR wrong number of arguments for 'hkeys'
command");
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.HKEYS, "1",
"2"))
- .hasMessageContaining("ERR wrong number of arguments for 'hkeys'
command");
+ assertExactNumberOfArgs(jedis, Protocol.Command.HKEYS, 1);
}
@Test
@@ -324,14 +317,7 @@ public abstract class AbstractHashesIntegrationTest
implements RedisPortSupplier
@Test
public void testHIncrBy_returnsErrorMessageForWrongNumberOfParameters() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.HINCRBY))
- .hasMessageContaining("ERR wrong number of arguments for 'hincrby'
command");
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.HINCRBY, "1"))
- .hasMessageContaining("ERR wrong number of arguments for 'hincrby'
command");
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.HINCRBY, "1",
"2"))
- .hasMessageContaining("ERR wrong number of arguments for 'hincrby'
command");
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.HINCRBY, "1",
"2", "3", "4"))
- .hasMessageContaining("ERR wrong number of arguments for 'hincrby'
command");
+ assertExactNumberOfArgs(jedis, Protocol.Command.HINCRBY, 3);
}
@Test
@@ -395,7 +381,7 @@ public abstract class AbstractHashesIntegrationTest
implements RedisPortSupplier
public void testHExists_isFalseForNonexistentKeyOrField() {
jedis.hset("key", "field", "value");
- assertThat(jedis.hexists("nonexitentKey", "someField")).isFalse();
+ assertThat(jedis.hexists("nonexistentKey", "someField")).isFalse();
assertThat(jedis.hexists("key", "nonexistentField")).isFalse();
}
@@ -414,7 +400,7 @@ public abstract class AbstractHashesIntegrationTest
implements RedisPortSupplier
@Test
public void testHExists_givenWrongNumberOfArguments() {
- assertExactNumberOfArgs(Protocol.Command.HEXISTS, 2);
+ assertExactNumberOfArgs(jedis, Protocol.Command.HEXISTS, 2);
}
@Test
@@ -501,7 +487,7 @@ public abstract class AbstractHashesIntegrationTest
implements RedisPortSupplier
@Test
public void hsetnx_shouldThrowError_givenWrongNumberOfArguments() {
- assertExactNumberOfArgs(Protocol.Command.HSETNX, 3);
+ assertExactNumberOfArgs(jedis, Protocol.Command.HSETNX, 3);
}
/**
@@ -541,18 +527,13 @@ public abstract class AbstractHashesIntegrationTest
implements RedisPortSupplier
}
@Test
- public void hvalsFails_withIncorrectParameters() {
- assertExactNumberOfArgs(Protocol.Command.HVALS, 1);
+ public void hvals_shouldError_givenWrongNumberOfArguments() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.HVALS, 1);
}
@Test
public void hget_shouldThrowError_givenWrongNumberOfArguments() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.HGET))
- .hasMessageContaining("ERR wrong number of arguments for 'hget'
command");
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.HGET, "1"))
- .hasMessageContaining("ERR wrong number of arguments for 'hget'
command");
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.HGET, "1",
"2", "3"))
- .hasMessageContaining("ERR wrong number of arguments for 'hget'
command");
+ assertExactNumberOfArgs(jedis, Protocol.Command.HGET, 2);
}
@Test
@@ -635,7 +616,7 @@ public abstract class AbstractHashesIntegrationTest
implements RedisPortSupplier
@Test
public void testHLen_givenWrongNumberOfArguments() {
- assertExactNumberOfArgs(Protocol.Command.HLEN, 1);
+ assertExactNumberOfArgs(jedis, Protocol.Command.HLEN, 1);
}
/**
@@ -827,7 +808,7 @@ public abstract class AbstractHashesIntegrationTest
implements RedisPortSupplier
}
@Test
- public void testConcurrentHIncrByFloat_sameKeyPerClient() throws
InterruptedException {
+ public void testConcurrentHIncrByFloat_sameKeyPerClient() {
String key = "HSET_KEY";
String field = "HSET_FIELD";
@@ -940,31 +921,4 @@ public abstract class AbstractHashesIntegrationTest
implements RedisPortSupplier
int expectedValue = Integer.parseInt(jedis.hget(key, field)) + increment;
assertThat(jedis.hincrBy(key, field, increment)).isEqualTo(expectedValue);
}
-
- private void assertExactNumberOfArgs(Protocol.Command command, int numArgs) {
- final int MAX_NUM_ARGS = 5; // currently enough for all implemented
commands
-
- for (int i = 0; i <= MAX_NUM_ARGS; i++) {
- if (i != numArgs) {
- byte[][] args = buildArgs(i);
- assertThatThrownBy(() -> jedis.sendCommand(command, args))
- .hasMessageContaining("ERR wrong number of arguments for '"
- + command.toString().toLowerCase() + "' command");
- }
- }
- }
-
- private byte[][] buildArgs(int numArgs) {
- byte[][] args = new byte[numArgs][];
-
- if (numArgs == 0) {
- return args;
- }
-
- for (int i = 0; i < numArgs; i++) {
- args[i] = String.valueOf(i).getBytes();
- }
-
- return args;
- }
}
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/hash/AbstractHincrByFloatIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/hash/AbstractHincrByFloatIntegrationTest.java
index d8f0ce6..f6e017b 100644
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/hash/AbstractHincrByFloatIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/hash/AbstractHincrByFloatIntegrationTest.java
@@ -15,6 +15,7 @@
package org.apache.geode.redis.internal.executor.hash;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.assertj.core.api.Assertions.offset;
@@ -55,28 +56,8 @@ public abstract class AbstractHincrByFloatIntegrationTest
implements RedisPortSu
}
@Test
- public void givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.HINCRBYFLOAT))
- .hasMessageContaining("ERR wrong number of arguments for
'hincrbyfloat' command");
- }
-
- @Test
- public void givenHashNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.HINCRBYFLOAT,
"key"))
- .hasMessageContaining("ERR wrong number of arguments for
'hincrbyfloat' command");
- }
-
- @Test
- public void givenIncrementNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.HINCRBYFLOAT,
"key", "hash"))
- .hasMessageContaining("ERR wrong number of arguments for
'hincrbyfloat' command");
- }
-
- @Test
- public void
givenMoreThanFourArgumentsProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(
- () -> jedis.sendCommand(Protocol.Command.HINCRBYFLOAT, "key", "hash",
"5", "extraArg"))
- .hasMessageContaining("ERR wrong number of arguments for
'hincrbyfloat' command");
+ public void errors_GivenWrongNumberOfArguments() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.HINCRBYFLOAT, 3);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractDelIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractDelIntegrationTest.java
index 77c1fd1..355177f 100644
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractDelIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractDelIntegrationTest.java
@@ -15,8 +15,8 @@
package org.apache.geode.redis.internal.executor.key;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertAtLeastNArgs;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
import java.util.concurrent.atomic.AtomicLong;
@@ -51,9 +51,8 @@ public abstract class AbstractDelIntegrationTest implements
RedisPortSupplier {
}
@Test
- public void givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.DEL))
- .hasMessageContaining("ERR wrong number of arguments for 'del'
command");
+ public void errors_givenTooFewArguments() {
+ assertAtLeastNArgs(jedis, Protocol.Command.DEL, 1);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractExistsIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractExistsIntegrationTest.java
index ec6d1ed..c7ca7e9 100644
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractExistsIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractExistsIntegrationTest.java
@@ -15,8 +15,8 @@
package org.apache.geode.redis.internal.executor.key;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertAtLeastNArgs;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
import java.util.concurrent.atomic.AtomicLong;
@@ -54,9 +54,8 @@ public abstract class AbstractExistsIntegrationTest
implements RedisPortSupplier
}
@Test
- public void givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.EXISTS))
- .hasMessageContaining("ERR wrong number of arguments for 'exists'
command");
+ public void errors_givenTooFewArguments() {
+ assertAtLeastNArgs(jedis, Protocol.Command.EXISTS, 1);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractExpireAtIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractExpireAtIntegrationTest.java
index fbd3057..b3518be 100644
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractExpireAtIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractExpireAtIntegrationTest.java
@@ -15,6 +15,7 @@
package org.apache.geode.redis.internal.executor.key;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.apache.geode.redis.internal.RedisConstants.ERROR_NOT_INTEGER;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -51,21 +52,8 @@ public abstract class AbstractExpireAtIntegrationTest
implements RedisPortSuppli
}
@Test
- public void givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.EXPIREAT))
- .hasMessageContaining("ERR wrong number of arguments for 'expireat'
command");
- }
-
- @Test
- public void givenTimestampNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.EXPIREAT,
"key"))
- .hasMessageContaining("ERR wrong number of arguments for 'expireat'
command");
- }
-
- @Test
- public void
givenMoreThanThreeArgumentsProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.EXPIREAT,
"key", "10", "extraArg"))
- .hasMessageContaining("ERR wrong number of arguments for 'expireat'
command");
+ public void errors_GivenWrongNumberOfParameters() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.EXPIREAT, 2);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractExpireIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractExpireIntegrationTest.java
index 750440d..8d678b7 100644
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractExpireIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractExpireIntegrationTest.java
@@ -15,6 +15,7 @@
package org.apache.geode.redis.internal.executor.key;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.apache.geode.redis.internal.RedisConstants.ERROR_NOT_INTEGER;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -46,21 +47,8 @@ public abstract class AbstractExpireIntegrationTest
implements RedisPortSupplier
}
@Test
- public void givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.EXPIRE))
- .hasMessageContaining("ERR wrong number of arguments for 'expire'
command");
- }
-
- @Test
- public void givenTimestampNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.EXPIRE, "key"))
- .hasMessageContaining("ERR wrong number of arguments for 'expire'
command");
- }
-
- @Test
- public void
givenMoreThanThreeArgumentsProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.EXPIRE, "key",
"10", "extraArg"))
- .hasMessageContaining("ERR wrong number of arguments for 'expire'
command");
+ public void errors_givenWrongNumberOfArguments() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.EXPIRE, 2);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractKeysIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractKeysIntegrationTest.java
index a726ad8..7694c93 100644
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractKeysIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractKeysIntegrationTest.java
@@ -15,8 +15,8 @@
package org.apache.geode.redis.internal.executor.key;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
@@ -48,15 +48,8 @@ public abstract class AbstractKeysIntegrationTest implements
RedisPortSupplier {
}
@Test
- public void givenPatternNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.KEYS))
- .hasMessageContaining("ERR wrong number of arguments for 'keys'
command");
- }
-
- @Test
- public void givenMoreThanTwoArguments_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.KEYS, "*",
"extraArg"))
- .hasMessageContaining("ERR wrong number of arguments for 'keys'
command");
+ public void errors_givenWrongNumberOfArguments() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.KEYS, 1);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractPExpireAtIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractPExpireAtIntegrationTest.java
index d585442..1413ea6 100644
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractPExpireAtIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractPExpireAtIntegrationTest.java
@@ -15,6 +15,7 @@
package org.apache.geode.redis.internal.executor.key;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.apache.geode.redis.internal.RedisConstants.ERROR_NOT_INTEGER;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -50,21 +51,8 @@ public abstract class AbstractPExpireAtIntegrationTest
implements RedisPortSuppl
}
@Test
- public void givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.PEXPIREAT))
- .hasMessageContaining("ERR wrong number of arguments for 'pexpireat'
command");
- }
-
- @Test
- public void givenTimestampNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.PEXPIREAT,
"key"))
- .hasMessageContaining("ERR wrong number of arguments for 'pexpireat'
command");
- }
-
- @Test
- public void
givenMoreThanThreeArgumentsProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.PEXPIREAT,
"key", "10", "extraArg"))
- .hasMessageContaining("ERR wrong number of arguments for 'pexpireat'
command");
+ public void errors_GivenWrongNumberOfArguments() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.PEXPIREAT, 2);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractPTTLIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractPTTLIntegrationTest.java
index 12224d3..32d00ba 100644
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractPTTLIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractPTTLIntegrationTest.java
@@ -15,8 +15,8 @@
package org.apache.geode.redis.internal.executor.key;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
import org.junit.After;
import org.junit.Before;
@@ -45,20 +45,8 @@ public abstract class AbstractPTTLIntegrationTest implements
RedisPortSupplier {
}
@Test
- public void givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.PTTL))
- .hasMessageContaining("ERR wrong number of arguments for 'pttl'
command");
- }
-
- @Test
- public void givenMoreThanTwoArguments_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.PTTL, "key",
"extraArg"))
- .hasMessageContaining("ERR wrong number of arguments for 'pttl'
command");
- }
-
- @Test
- public void shouldReturnNegativeTwo_givenKeyDoesNotExist() {
- assertThat(jedis.pttl("doesNotExist")).isEqualTo(-2);
+ public void errors_GivenWrongNumberOfArguments() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.PTTL, 1);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractPersistIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractPersistIntegrationTest.java
index 74f427e..2821e53 100644
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractPersistIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractPersistIntegrationTest.java
@@ -15,8 +15,8 @@
package org.apache.geode.redis.internal.executor.key;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
import java.util.concurrent.atomic.AtomicLong;
@@ -51,15 +51,8 @@ public abstract class AbstractPersistIntegrationTest
implements RedisPortSupplie
}
@Test
- public void givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.PERSIST))
- .hasMessageContaining("ERR wrong number of arguments for 'persist'
command");
- }
-
- @Test
- public void givenMoreThanTwoArguments_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.PERSIST,
"key", "extraArg"))
- .hasMessageContaining("ERR wrong number of arguments for 'persist'
command");
+ public void errors_GivenWrongNumberOfArguments() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.PERSIST, 1);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractPexpireIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractPexpireIntegrationTest.java
index 7b125de..54fd1f7 100644
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractPexpireIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractPexpireIntegrationTest.java
@@ -15,6 +15,7 @@
package org.apache.geode.redis.internal.executor.key;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.apache.geode.redis.internal.RedisConstants.ERROR_NOT_INTEGER;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -46,21 +47,8 @@ public abstract class AbstractPexpireIntegrationTest
implements RedisPortSupplie
}
@Test
- public void givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.PEXPIRE))
- .hasMessageContaining("ERR wrong number of arguments for 'pexpire'
command");
- }
-
- @Test
- public void givenTimestampNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.PEXPIRE,
"key"))
- .hasMessageContaining("ERR wrong number of arguments for 'pexpire'
command");
- }
-
- @Test
- public void
givenMoreThanThreeArgumentsProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.PEXPIRE,
"key", "10", "extraArg"))
- .hasMessageContaining("ERR wrong number of arguments for 'pexpire'
command");
+ public void errors_GivenWrongNumberOfArguments() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.PEXPIRE, 2);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractRenameIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractRenameIntegrationTest.java
index 77f8361..9397a80 100644
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractRenameIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractRenameIntegrationTest.java
@@ -15,8 +15,8 @@
package org.apache.geode.redis.internal.executor.key;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
import java.util.ArrayList;
import java.util.Arrays;
@@ -71,15 +71,8 @@ public abstract class AbstractRenameIntegrationTest
implements RedisPortSupplier
}
@Test
- public void testTooFewArgs() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.RENAME, "foo"))
- .hasMessageContaining("wrong number of arguments");
- }
-
- @Test
- public void testTooManyArgs() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.RENAME, "foo",
"newfoo", "bluefoo"))
- .hasMessageContaining("wrong number of arguments");
+ public void errors_GivenWrongNumberOfArguments() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.RENAME, 2);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractTTLIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractTTLIntegrationTest.java
index e3958df..03206f4 100644
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractTTLIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractTTLIntegrationTest.java
@@ -15,9 +15,9 @@
package org.apache.geode.redis.internal.executor.key;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.apache.geode.test.awaitility.GeodeAwaitility.await;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
import java.util.concurrent.TimeUnit;
@@ -48,15 +48,8 @@ public abstract class AbstractTTLIntegrationTest implements
RedisPortSupplier {
}
@Test
- public void givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.TTL))
- .hasMessageContaining("ERR wrong number of arguments for 'ttl'
command");
- }
-
- @Test
- public void givenMoreThanTwoArguments_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.TTL, "key",
"extraArg"))
- .hasMessageContaining("ERR wrong number of arguments for 'ttl'
command");
+ public void errors_GivenWrongNumberOfArguments() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.TTL, 1);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractTypeIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractTypeIntegrationTest.java
index 5b4f00a..fd39940 100644
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractTypeIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractTypeIntegrationTest.java
@@ -15,8 +15,8 @@
package org.apache.geode.redis.internal.executor.key;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
import org.junit.After;
import org.junit.Before;
@@ -50,15 +50,8 @@ public abstract class AbstractTypeIntegrationTest implements
RedisPortSupplier {
}
@Test
- public void shouldThrowError_givenTooFewArgs() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.TYPE))
- .hasMessageContaining("wrong number of arguments");
- }
-
- @Test
- public void shouldThrowError_givenTooManyArgs() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.TYPE,
"orange", "blue"))
- .hasMessageContaining("wrong number of arguments");
+ public void errors_GivenWrongNumberOfArguments() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.TYPE, 1);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractUnlinkIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractUnlinkIntegrationTest.java
index b73113e..bfb6d66 100644
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractUnlinkIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractUnlinkIntegrationTest.java
@@ -15,8 +15,8 @@
package org.apache.geode.redis.internal.executor.key;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertAtLeastNArgs;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
import java.util.concurrent.atomic.AtomicLong;
@@ -51,9 +51,8 @@ public abstract class AbstractUnlinkIntegrationTest
implements RedisPortSupplier
}
@Test
- public void givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.UNLINK))
- .hasMessageContaining("ERR wrong number of arguments for 'unlink'
command");
+ public void errors_GivenTooFewArguments() {
+ assertAtLeastNArgs(jedis, Protocol.Command.UNLINK, 1);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/server/AbstractTimeIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/server/AbstractTimeIntegrationTest.java
index b6a6fbe..08f3027 100644
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/server/AbstractTimeIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/server/AbstractTimeIntegrationTest.java
@@ -16,8 +16,8 @@
package org.apache.geode.redis.internal.executor.server;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
import java.util.List;
@@ -48,8 +48,7 @@ public abstract class AbstractTimeIntegrationTest implements
RedisPortSupplier {
@Test
public void givenMoreThanOneArgument_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.TIME,
"extraArg"))
- .hasMessageContaining("ERR wrong number of arguments for 'time'
command");
+ assertExactNumberOfArgs(jedis, Protocol.Command.TIME, 0);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/set/AbstractSDiffIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/set/AbstractSDiffIntegrationTest.java
index 0fb4ff2..5fc0d81 100755
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/set/AbstractSDiffIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/set/AbstractSDiffIntegrationTest.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.redis.internal.executor.set;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertAtLeastNArgs;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -51,21 +52,13 @@ public abstract class AbstractSDiffIntegrationTest
implements RedisPortSupplier
}
@Test
- public void sdiff_givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SDIFF))
- .hasMessageContaining("ERR wrong number of arguments for 'sdiff'
command");
+ public void sdiffErrors_givenTooFewArguments() {
+ assertAtLeastNArgs(jedis, Protocol.Command.SDIFF, 1);
}
@Test
- public void
sdiffstore_givenDestinationNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SDIFFSTORE))
- .hasMessageContaining("ERR wrong number of arguments for 'sdiffstore'
command");
- }
-
- @Test
- public void
sdiffstore_givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SDIFFSTORE,
"destination"))
- .hasMessageContaining("ERR wrong number of arguments for 'sdiffstore'
command");
+ public void sdiffstoreErrors_givenTooFewArguments() {
+ assertAtLeastNArgs(jedis, Protocol.Command.SDIFFSTORE, 2);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/set/AbstractSInterIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/set/AbstractSInterIntegrationTest.java
index 56af8b1..ab26eff 100755
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/set/AbstractSInterIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/set/AbstractSInterIntegrationTest.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.redis.internal.executor.set;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertAtLeastNArgs;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -51,21 +52,13 @@ public abstract class AbstractSInterIntegrationTest
implements RedisPortSupplier
}
@Test
- public void sinter_givenKeyProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SINTER))
- .hasMessageContaining("ERR wrong number of arguments for 'sinter'
command");
+ public void sinterErrors_givenTooFewArguments() {
+ assertAtLeastNArgs(jedis, Protocol.Command.SINTER, 1);
}
@Test
- public void
sinterstore_givenDestinationProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SINTERSTORE))
- .hasMessageContaining("ERR wrong number of arguments for 'sinterstore'
command");
- }
-
- @Test
- public void
sinterstore_givenKeyProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SINTERSTORE,
"destination"))
- .hasMessageContaining("ERR wrong number of arguments for 'sinterstore'
command");
+ public void sinterstoreErrors_givenTooFewArguments() {
+ assertAtLeastNArgs(jedis, Protocol.Command.SINTERSTORE, 2);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/set/AbstractSIsMemberIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/set/AbstractSIsMemberIntegrationTest.java
index 54d8b52..ec03f1d 100755
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/set/AbstractSIsMemberIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/set/AbstractSIsMemberIntegrationTest.java
@@ -14,8 +14,8 @@
*/
package org.apache.geode.redis.internal.executor.set;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
import java.util.HashSet;
import java.util.Set;
@@ -48,22 +48,8 @@ public abstract class AbstractSIsMemberIntegrationTest
implements RedisPortSuppl
}
@Test
- public void givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SISMEMBER))
- .hasMessageContaining("ERR wrong number of arguments for 'sismember'
command");
- }
-
- @Test
- public void givenMemberNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SISMEMBER,
"key"))
- .hasMessageContaining("ERR wrong number of arguments for 'sismember'
command");
- }
-
- @Test
- public void givenMoreThanThreeArguments_returnsWrongNumberOfArgumentsError()
{
- assertThatThrownBy(
- () -> jedis.sendCommand(Protocol.Command.SISMEMBER, "key", "member",
"extraArg"))
- .hasMessageContaining("ERR wrong number of arguments for
'sismember' command");
+ public void errors_givenWrongNumberOfArguments() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.SISMEMBER, 2);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/set/AbstractSMoveIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/set/AbstractSMoveIntegrationTest.java
index 020760d..3090c95 100755
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/set/AbstractSMoveIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/set/AbstractSMoveIntegrationTest.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.redis.internal.executor.set;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -54,28 +55,8 @@ public abstract class AbstractSMoveIntegrationTest
implements RedisPortSupplier
}
@Test
- public void givenSourceNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SMOVE))
- .hasMessageContaining("ERR wrong number of arguments for 'smove'
command");
- }
-
- @Test
- public void givenDestinationNotProvided_returnsWrongNumberOfArgumentsError()
{
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SMOVE,
"source"))
- .hasMessageContaining("ERR wrong number of arguments for 'smove'
command");
- }
-
- @Test
- public void givenMemberNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SMOVE,
"source", "destination"))
- .hasMessageContaining("ERR wrong number of arguments for 'smove'
command");
- }
-
- @Test
- public void givenMoreThanFourArguments_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(
- () -> jedis.sendCommand(Protocol.Command.SMOVE, "key", "destination",
"member", "extraArg"))
- .hasMessageContaining("ERR wrong number of arguments for 'smove'
command");
+ public void errors_GivenWrongNumberOfArguments() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.SMOVE, 3);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/set/AbstractSRemIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/set/AbstractSRemIntegrationTest.java
index 705898b..3881f43 100755
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/set/AbstractSRemIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/set/AbstractSRemIntegrationTest.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.redis.internal.executor.set;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertAtLeastNArgs;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -51,15 +52,8 @@ public abstract class AbstractSRemIntegrationTest implements
RedisPortSupplier {
}
@Test
- public void givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SREM))
- .hasMessageContaining("ERR wrong number of arguments for 'srem'
command");
- }
-
- @Test
- public void givenMemberNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SREM, "key"))
- .hasMessageContaining("ERR wrong number of arguments for 'srem'
command");
+ public void errors_givenTooFewArguments() {
+ assertAtLeastNArgs(jedis, Protocol.Command.SREM, 2);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/set/AbstractSUnionIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/set/AbstractSUnionIntegrationTest.java
index e2b80d8..a7c2119 100755
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/set/AbstractSUnionIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/set/AbstractSUnionIntegrationTest.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.redis.internal.executor.set;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertAtLeastNArgs;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -51,21 +52,13 @@ public abstract class AbstractSUnionIntegrationTest
implements RedisPortSupplier
}
@Test
- public void sunion_givenKeyProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SUNION))
- .hasMessageContaining("ERR wrong number of arguments for 'sunion'
command");
+ public void sunionErrors_givenTooFewArguments() {
+ assertAtLeastNArgs(jedis, Protocol.Command.SUNION, 1);
}
@Test
- public void
sunionstore_givenDestinationProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SUNIONSTORE))
- .hasMessageContaining("ERR wrong number of arguments for 'sunionstore'
command");
- }
-
- @Test
- public void
sunionstore_givenKeyProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SUNIONSTORE,
"destination"))
- .hasMessageContaining("ERR wrong number of arguments for 'sunionstore'
command");
+ public void sunionstroreErrors_givenTooFewArgumentst() {
+ assertAtLeastNArgs(jedis, Protocol.Command.SUNIONSTORE, 2);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/set/AbstractSetsIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/set/AbstractSetsIntegrationTest.java
index e531493..a554e90 100755
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/set/AbstractSetsIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/set/AbstractSetsIntegrationTest.java
@@ -14,6 +14,8 @@
*/
package org.apache.geode.redis.internal.executor.set;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertAtLeastNArgs;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -59,27 +61,13 @@ public abstract class AbstractSetsIntegrationTest
implements RedisPortSupplier {
}
@Test
- public void sadd_givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SADD))
- .hasMessageContaining("ERR wrong number of arguments for 'sadd'
command");
+ public void saddErrors_givenTooFewArguments() {
+ assertAtLeastNArgs(jedis, Protocol.Command.SADD, 2);
}
@Test
- public void sadd_givenMemberNotProvided_returnsWrongNumberOfArgumentsError()
{
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SADD, "key"))
- .hasMessageContaining("ERR wrong number of arguments for 'sadd'
command");
- }
-
- @Test
- public void scard_givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SCARD))
- .hasMessageContaining("ERR wrong number of arguments for 'scard'
command");
- }
-
- @Test
- public void
scard_givenMoreThanTwoArguments_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SCARD, "key",
"extraArg"))
- .hasMessageContaining("ERR wrong number of arguments for 'scard'
command");
+ public void scardErrors_givenWrongNumberOfArguments() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.SCARD, 1);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractBitCountIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractBitCountIntegrationTest.java
index 2e641a9..c7bff31 100755
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractBitCountIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractBitCountIntegrationTest.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.redis.internal.executor.string;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertAtLeastNArgs;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -44,9 +45,8 @@ public abstract class AbstractBitCountIntegrationTest
implements RedisPortSuppli
}
@Test
- public void
bitcount_givenLessThanTwoArguments_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.BITCOUNT))
- .hasMessageContaining("ERR wrong number of arguments for 'bitcount'
command");
+ public void bitcount_errors_givenTooFewArguments() {
+ assertAtLeastNArgs(jedis, Protocol.Command.BITCOUNT, 1);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractBitOpIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractBitOpIntegrationTest.java
index af0a8ac..da5862f 100755
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractBitOpIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractBitOpIntegrationTest.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.redis.internal.executor.string;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertAtLeastNArgs;
import static org.apache.geode.redis.internal.RedisConstants.ERROR_SYNTAX;
import static org.apache.geode.redis.internal.RedisConstants.ERROR_WRONG_TYPE;
import static
org.apache.geode.redis.internal.executor.string.BitOpExecutor.ERROR_BITOP_NOT;
@@ -45,21 +46,8 @@ public abstract class AbstractBitOpIntegrationTest
implements RedisPortSupplier
}
@Test
- public void
bitop_givenOperationNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.BITOP))
- .hasMessageContaining("ERR wrong number of arguments for 'bitop'
command");
- }
-
- @Test
- public void
bitop_givenDestinationKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.BITOP, "AND"))
- .hasMessageContaining("ERR wrong number of arguments for 'bitop'
command");
- }
-
- @Test
- public void
bitop_givenSourceKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.BITOP, "AND",
"destKey"))
- .hasMessageContaining("ERR wrong number of arguments for 'bitop'
command");
+ public void bitOp_errors_givenTooFewArguments() {
+ assertAtLeastNArgs(jedis, Protocol.Command.BITOP, 3);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractBitPosIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractBitPosIntegrationTest.java
index 9130912..e14a8b6 100755
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractBitPosIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractBitPosIntegrationTest.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.redis.internal.executor.string;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertAtLeastNArgs;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -45,15 +46,8 @@ public abstract class AbstractBitPosIntegrationTest
implements RedisPortSupplier
}
@Test
- public void bitpos_givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.BITPOS))
- .hasMessageContaining("ERR wrong number of arguments for 'bitpos'
command");
- }
-
- @Test
- public void bitpos_givenBitNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.BITPOS, "key"))
- .hasMessageContaining("ERR wrong number of arguments for 'bitpos'
command");
+ public void bitpos_errors_givenTooFewArguments() {
+ assertAtLeastNArgs(jedis, Protocol.Command.BITPOS, 2);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractDecrByIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractDecrByIntegrationTest.java
index 5bc1005..af7d3d0 100755
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractDecrByIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractDecrByIntegrationTest.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.redis.internal.executor.string;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.apache.geode.redis.internal.RedisConstants.ERROR_NOT_INTEGER;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -49,21 +50,8 @@ public abstract class AbstractDecrByIntegrationTest
implements RedisPortSupplier
}
@Test
- public void givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.DECRBY))
- .hasMessageContaining("ERR wrong number of arguments for 'decrby'
command");
- }
-
- @Test
- public void givenDecrementNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.DECRBY, "key"))
- .hasMessageContaining("ERR wrong number of arguments for 'decrby'
command");
- }
-
- @Test
- public void
givenMoreThanThreeArgumentsProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.DECRBY, "key",
"3", "extraArg"))
- .hasMessageContaining("ERR wrong number of arguments for 'decrby'
command");
+ public void decrBy_errors_givenWrongNumberOfArguments() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.DECRBY, 2);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractDecrIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractDecrIntegrationTest.java
index 43684de..1030233 100755
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractDecrIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractDecrIntegrationTest.java
@@ -14,8 +14,8 @@
*/
package org.apache.geode.redis.internal.executor.string;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
import org.junit.After;
import org.junit.Before;
@@ -48,15 +48,8 @@ public abstract class AbstractDecrIntegrationTest implements
RedisPortSupplier {
}
@Test
- public void givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.DECR))
- .hasMessageContaining("ERR wrong number of arguments for 'decr'
command");
- }
-
- @Test
- public void givenMoreThanTwoArguments_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.DECR, "key",
"extraArg"))
- .hasMessageContaining("ERR wrong number of arguments for 'decr'
command");
+ public void errors_givenWrongNumberOfArguments() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.DECR, 1);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractGetBitIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractGetBitIntegrationTest.java
index a0680c3..26ef945 100755
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractGetBitIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractGetBitIntegrationTest.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.redis.internal.executor.string;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -44,21 +45,8 @@ public abstract class AbstractGetBitIntegrationTest
implements RedisPortSupplier
}
@Test
- public void givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.GETBIT))
- .hasMessageContaining("ERR wrong number of arguments for 'getbit'
command");
- }
-
- @Test
- public void givenOffsetNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.GETBIT, "key"))
- .hasMessageContaining("ERR wrong number of arguments for 'getbit'
command");
- }
-
- @Test
- public void
givenMoreThanThreeArgumentsProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.GETBIT, "key",
"4", "extraArg"))
- .hasMessageContaining("ERR wrong number of arguments for 'getbit'
command");
+ public void errors_givenWrongNumberOfArguments() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.GETBIT, 2);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractGetIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractGetIntegrationTest.java
index d87082c..92c2f02 100755
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractGetIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractGetIntegrationTest.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.redis.internal.executor.string;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.apache.geode.redis.internal.RedisConstants.ERROR_WRONG_TYPE;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -45,15 +46,8 @@ public abstract class AbstractGetIntegrationTest implements
RedisPortSupplier {
}
@Test
- public void givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.GET))
- .hasMessageContaining("ERR wrong number of arguments for 'get'
command");
- }
-
- @Test
- public void givenMoreThanTwoArguments_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.GET, "key",
"extraArg"))
- .hasMessageContaining("ERR wrong number of arguments for 'get'
command");
+ public void errors_givenWrongNumberOfArguments() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.GET, 1);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractGetRangeIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractGetRangeIntegrationTest.java
index 8f5d21f..530b974 100755
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractGetRangeIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractGetRangeIntegrationTest.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.redis.internal.executor.string;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.apache.geode.redis.internal.RedisConstants.ERROR_NOT_INTEGER;
import static org.apache.geode.redis.internal.RedisConstants.ERROR_WRONG_TYPE;
import static org.assertj.core.api.Assertions.assertThat;
@@ -51,28 +52,8 @@ public abstract class AbstractGetRangeIntegrationTest
implements RedisPortSuppli
}
@Test
- public void givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.GETRANGE))
- .hasMessageContaining("ERR wrong number of arguments for 'getrange'
command");
- }
-
- @Test
- public void givenStartNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.GETRANGE,
"key"))
- .hasMessageContaining("ERR wrong number of arguments for 'getrange'
command");
- }
-
- @Test
- public void givenEndNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.GETRANGE,
"key", "1"))
- .hasMessageContaining("ERR wrong number of arguments for 'getrange'
command");
- }
-
- @Test
- public void
givenMoreThanFourArgumentsProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(
- () -> jedis.sendCommand(Protocol.Command.GETRANGE, "key", "1", "5",
"extraArg"))
- .hasMessageContaining("ERR wrong number of arguments for
'getrange' command");
+ public void errors_givenWrongNumberOfArguments() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.GETRANGE, 3);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractGetSetIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractGetSetIntegrationTest.java
index b7e4787..27efbda 100755
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractGetSetIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractGetSetIntegrationTest.java
@@ -15,6 +15,7 @@
package org.apache.geode.redis.internal.executor.string;
import static java.lang.Integer.parseInt;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -58,21 +59,8 @@ public abstract class AbstractGetSetIntegrationTest
implements RedisPortSupplier
}
@Test
- public void givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.GETSET))
- .hasMessageContaining("ERR wrong number of arguments for 'getset'
command");
- }
-
- @Test
- public void givenValueNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.GETSET, "key"))
- .hasMessageContaining("ERR wrong number of arguments for 'getset'
command");
- }
-
- @Test
- public void
givenMoreThanThreeArgumentsProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.GETSET, "key",
"value", "extraArg"))
- .hasMessageContaining("ERR wrong number of arguments for 'getset'
command");
+ public void errors_givenWrongNumberOfParameters() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.GETSET, 2);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractIncrByFloatIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractIncrByFloatIntegrationTest.java
index 8906f42..15dcddd 100755
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractIncrByFloatIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractIncrByFloatIntegrationTest.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.redis.internal.executor.string;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -50,22 +51,8 @@ public abstract class AbstractIncrByFloatIntegrationTest
implements RedisPortSup
}
@Test
- public void givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.INCRBYFLOAT))
- .hasMessageContaining("ERR wrong number of arguments for 'incrbyfloat'
command");
- }
-
- @Test
- public void givenIncrementNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.INCRBYFLOAT,
"key"))
- .hasMessageContaining("ERR wrong number of arguments for 'incrbyfloat'
command");
- }
-
- @Test
- public void
givenMoreThanThreeArgumentsProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(
- () -> jedis.sendCommand(Protocol.Command.INCRBYFLOAT, "key", "5",
"extraArg"))
- .hasMessageContaining("ERR wrong number of arguments for
'incrbyfloat' command");
+ public void errors_givenWrongNumberOfParameters() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.INCRBYFLOAT, 2);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractIncrByIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractIncrByIntegrationTest.java
index a3e55d1..6b051c1 100755
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractIncrByIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractIncrByIntegrationTest.java
@@ -14,8 +14,8 @@
*/
package org.apache.geode.redis.internal.executor.string;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
import java.util.Random;
@@ -48,21 +48,8 @@ public abstract class AbstractIncrByIntegrationTest
implements RedisPortSupplier
}
@Test
- public void givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.INCRBY))
- .hasMessageContaining("ERR wrong number of arguments for 'incrby'
command");
- }
-
- @Test
- public void givenIncrementNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.INCRBY, "key"))
- .hasMessageContaining("ERR wrong number of arguments for 'incrby'
command");
- }
-
- @Test
- public void
givenMoreThanThreeArgumentsProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.INCRBY, "key",
"5", "extraArg"))
- .hasMessageContaining("ERR wrong number of arguments for 'incrby'
command");
+ public void errors_givenWrongNumberOfArguments() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.INCRBY, 2);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractIncrIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractIncrIntegrationTest.java
index 9dd632d..d45b965 100755
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractIncrIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractIncrIntegrationTest.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.redis.internal.executor.string;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.apache.geode.redis.internal.RedisConstants.ERROR_NOT_INTEGER;
import static org.apache.geode.redis.internal.RedisConstants.ERROR_OVERFLOW;
import static org.assertj.core.api.Assertions.assertThat;
@@ -50,15 +51,8 @@ public abstract class AbstractIncrIntegrationTest implements
RedisPortSupplier {
}
@Test
- public void givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.INCR))
- .hasMessageContaining("ERR wrong number of arguments for 'incr'
command");
- }
-
- @Test
- public void
givenMoreThanTwoArgumentsProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.INCR, "key",
"extraArg"))
- .hasMessageContaining("ERR wrong number of arguments for 'incr'
command");
+ public void errors_givenWrongNumberOfArguments() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.INCR, 1);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractMGetIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractMGetIntegrationTest.java
index 5f45a08..7130121 100755
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractMGetIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractMGetIntegrationTest.java
@@ -14,8 +14,8 @@
*/
package org.apache.geode.redis.internal.executor.string;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertAtLeastNArgs;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
import java.util.stream.IntStream;
@@ -47,9 +47,8 @@ public abstract class AbstractMGetIntegrationTest implements
RedisPortSupplier {
}
@Test
- public void givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.MGET))
- .hasMessageContaining("ERR wrong number of arguments for 'mget'
command");
+ public void errors_givenWrongNumberOfArguments() {
+ assertAtLeastNArgs(jedis, Protocol.Command.MGET, 1);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractPSetEXIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractPSetEXIntegrationTest.java
index c09ccbc..a06b2cb 100755
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractPSetEXIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractPSetEXIntegrationTest.java
@@ -14,8 +14,8 @@
*/
package org.apache.geode.redis.internal.executor.string;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
import org.junit.After;
import org.junit.Before;
@@ -44,28 +44,8 @@ public abstract class AbstractPSetEXIntegrationTest
implements RedisPortSupplier
}
@Test
- public void givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.PSETEX))
- .hasMessageContaining("ERR wrong number of arguments for 'psetex'
command");
- }
-
- @Test
- public void givenTimeNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.PSETEX, "key"))
- .hasMessageContaining("ERR wrong number of arguments for 'psetex'
command");
- }
-
- @Test
- public void givenValueNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.PSETEX, "key",
"1000"))
- .hasMessageContaining("ERR wrong number of arguments for 'psetex'
command");
- }
-
- @Test
- public void
givenMoreThanFourArgumentsProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(
- () -> jedis.sendCommand(Protocol.Command.PSETEX, "key", "1000",
"value", "extraArg"))
- .hasMessageContaining("ERR wrong number of arguments for 'psetex'
command");
+ public void errors_givenWrongNumberOfArguments() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.PSETEX, 3);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractSetBitIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractSetBitIntegrationTest.java
index 16a54e3..056d27a 100755
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractSetBitIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractSetBitIntegrationTest.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.redis.internal.executor.string;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -44,21 +45,8 @@ public abstract class AbstractSetBitIntegrationTest
implements RedisPortSupplier
}
@Test
- public void givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SETBIT))
- .hasMessageContaining("ERR wrong number of arguments for 'setbit'
command");
- }
-
- @Test
- public void givenOffsetNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SETBIT, "key"))
- .hasMessageContaining("ERR wrong number of arguments for 'setbit'
command");
- }
-
- @Test
- public void givenValueNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SETBIT, "key",
"1"))
- .hasMessageContaining("ERR wrong number of arguments for 'setbit'
command");
+ public void errors_givenWrongNumberOfArguments() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.SETBIT, 3);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractSetEXIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractSetEXIntegrationTest.java
index f5f7640..ecd39bd 100755
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractSetEXIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractSetEXIntegrationTest.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.redis.internal.executor.string;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -51,21 +52,8 @@ public abstract class AbstractSetEXIntegrationTest
implements RedisPortSupplier
}
@Test
- public void givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SETEX))
- .hasMessageContaining("ERR wrong number of arguments for 'setex'
command");
- }
-
- @Test
- public void givenTimeNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SETEX, "key"))
- .hasMessageContaining("ERR wrong number of arguments for 'setex'
command");
- }
-
- @Test
- public void givenValueNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SETEX, "key",
"10"))
- .hasMessageContaining("ERR wrong number of arguments for 'setex'
command");
+ public void errors_givenWrongNumberOfArguments() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.SETEX, 3);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractSetRangeIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractSetRangeIntegrationTest.java
index 072a9da..4c59536 100755
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractSetRangeIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractSetRangeIntegrationTest.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.redis.internal.executor.string;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -44,28 +45,8 @@ public abstract class AbstractSetRangeIntegrationTest
implements RedisPortSuppli
}
@Test
- public void givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SETRANGE))
- .hasMessageContaining("ERR wrong number of arguments for 'setrange'
command");
- }
-
- @Test
- public void givenOffsetNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SETRANGE,
"key"))
- .hasMessageContaining("ERR wrong number of arguments for 'setrange'
command");
- }
-
- @Test
- public void givenValueNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.SETRANGE,
"key", "5"))
- .hasMessageContaining("ERR wrong number of arguments for 'setrange'
command");
- }
-
- @Test
- public void
givenMoreThanFourArgumentsProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(
- () -> jedis.sendCommand(Protocol.Command.SETRANGE, "key", "5",
"value", "extraArg"))
- .hasMessageContaining("ERR wrong number of arguments for
'setrange' command");
+ public void errors_givenWrongNumberOfArguments() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.SETRANGE, 3);
}
@Test
diff --git
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractStringIntegrationTest.java
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractStringIntegrationTest.java
index 5c497d3..ecc2144 100755
---
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractStringIntegrationTest.java
+++
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/string/AbstractStringIntegrationTest.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.redis.internal.executor.string;
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -48,15 +49,8 @@ public abstract class AbstractStringIntegrationTest
implements RedisPortSupplier
}
@Test
- public void givenKeyNotProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.STRLEN))
- .hasMessageContaining("ERR wrong number of arguments for 'strlen'
command");
- }
-
- @Test
- public void
givenMoreThanTwoArgumentsProvided_returnsWrongNumberOfArgumentsError() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.STRLEN, "key",
"extraArg"))
- .hasMessageContaining("ERR wrong number of arguments for 'strlen'
command");
+ public void strlen_errorsGivenWrongNumberOfArguments() {
+ assertExactNumberOfArgs(jedis, Protocol.Command.STRLEN, 1);
}
@Test
@@ -130,10 +124,7 @@ public abstract class AbstractStringIntegrationTest
implements RedisPortSupplier
@Test
public void testDecr_ErrorsWithWrongNumberOfArguments() {
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.DECR))
- .hasMessageContaining("ERR wrong number of arguments for 'decr'
command");
- assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.DECR, "1",
"2"))
- .hasMessageContaining("ERR wrong number of arguments for 'decr'
command");
+ assertExactNumberOfArgs(jedis, Protocol.Command.DECR, 1);
}
@Test