Skip to content

Commit

Permalink
Correct CommandArguments for zrevrangebyscore (#2972)
Browse files Browse the repository at this point in the history
* Correct commandarguments for zrevrangebyscore

* add unit test for zrevrangebyscore

Co-authored-by: Daphne Hsieh <[email protected]>
  • Loading branch information
daphne830304 and daphnehsieh authored Apr 7, 2022
1 parent ec3582a commit a41c7c6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/redis/clients/jedis/CommandObjects.java
Original file line number Diff line number Diff line change
Expand Up @@ -1516,7 +1516,7 @@ public final CommandObject<List<String>> zrevrangeByScore(String key, double max
}

public final CommandObject<List<String>> 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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,13 @@ public void zrevrangebyscore() {

assertEquals(expected, range);

range = jedis.zrevrangeByScore("foo", "4", "2", 0, 2);
expected = new ArrayList<String>();
expected.add("d");
expected.add("c");

assertEquals(expected, range);

range = jedis.zrevrangeByScore("foo", "+inf", "(4");
expected = new ArrayList<String>();
expected.add("e");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,13 @@ public void zrevrangebyscore() {

assertEquals(expected, range);

range = jedis.zrevrangeByScore("foo", "4", "2", 0, 2);
expected = new ArrayList<String>();
expected.add("d");
expected.add("c");

assertEquals(expected, range);

range = jedis.zrevrangeByScore("foo", "+inf", "(4");
expected = new ArrayList<String>();
expected.add("e");
Expand Down

0 comments on commit a41c7c6

Please sign in to comment.