From a41c7c61b149d4c50b4fa578fa2533297909707b Mon Sep 17 00:00:00 2001 From: daphne830304 <55413390+daphne830304@users.noreply.github.com> Date: Thu, 7 Apr 2022 02:50:58 -0700 Subject: [PATCH] Correct CommandArguments for zrevrangebyscore (#2972) * Correct commandarguments for zrevrangebyscore * add unit test for zrevrangebyscore Co-authored-by: Daphne Hsieh --- src/main/java/redis/clients/jedis/CommandObjects.java | 2 +- .../jedis/commands/jedis/SortedSetCommandsTest.java | 7 +++++++ .../jedis/commands/unified/SortedSetCommandsTestBase.java | 7 +++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/redis/clients/jedis/CommandObjects.java b/src/main/java/redis/clients/jedis/CommandObjects.java index 15cfebaed5..483704d630 100644 --- a/src/main/java/redis/clients/jedis/CommandObjects.java +++ b/src/main/java/redis/clients/jedis/CommandObjects.java @@ -1516,7 +1516,7 @@ public final CommandObject> zrevrangeByScore(String key, double max } public final CommandObject> zrevrangeByScore(String key, String max, String min, int offset, int count) { - return new CommandObject<>(commandArguments(ZRANGEBYSCORE).key(key).add(max).add(min) + return new CommandObject<>(commandArguments(ZREVRANGEBYSCORE).key(key).add(max).add(min) .add(LIMIT).add(offset).add(count), BuilderFactory.STRING_LIST); } diff --git a/src/test/java/redis/clients/jedis/commands/jedis/SortedSetCommandsTest.java b/src/test/java/redis/clients/jedis/commands/jedis/SortedSetCommandsTest.java index bfe1061312..9ab789fd29 100644 --- a/src/test/java/redis/clients/jedis/commands/jedis/SortedSetCommandsTest.java +++ b/src/test/java/redis/clients/jedis/commands/jedis/SortedSetCommandsTest.java @@ -859,6 +859,13 @@ public void zrevrangebyscore() { assertEquals(expected, range); + range = jedis.zrevrangeByScore("foo", "4", "2", 0, 2); + expected = new ArrayList(); + expected.add("d"); + expected.add("c"); + + assertEquals(expected, range); + range = jedis.zrevrangeByScore("foo", "+inf", "(4"); expected = new ArrayList(); expected.add("e"); diff --git a/src/test/java/redis/clients/jedis/commands/unified/SortedSetCommandsTestBase.java b/src/test/java/redis/clients/jedis/commands/unified/SortedSetCommandsTestBase.java index e0957ec74a..c02b712cac 100644 --- a/src/test/java/redis/clients/jedis/commands/unified/SortedSetCommandsTestBase.java +++ b/src/test/java/redis/clients/jedis/commands/unified/SortedSetCommandsTestBase.java @@ -916,6 +916,13 @@ public void zrevrangebyscore() { assertEquals(expected, range); + range = jedis.zrevrangeByScore("foo", "4", "2", 0, 2); + expected = new ArrayList(); + expected.add("d"); + expected.add("c"); + + assertEquals(expected, range); + range = jedis.zrevrangeByScore("foo", "+inf", "(4"); expected = new ArrayList(); expected.add("e");