getIntegerReply should return Integer and not int to support null replies
This commit is contained in:
@@ -126,9 +126,9 @@ public class Connection {
|
||||
return (String) protocol.read(inputStream);
|
||||
}
|
||||
|
||||
public int getIntegerReply() {
|
||||
public Integer getIntegerReply() {
|
||||
pipelinedCommands--;
|
||||
return ((Integer) protocol.read(inputStream)).intValue();
|
||||
return (Integer) protocol.read(inputStream);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -100,11 +100,14 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
|
||||
jedis.zadd("foo", 1d, "a");
|
||||
jedis.zadd("foo", 2d, "b");
|
||||
|
||||
int rank = jedis.zrank("foo", "a");
|
||||
assertEquals(0, rank);
|
||||
Integer rank = jedis.zrank("foo", "a");
|
||||
assertEquals(0, rank.intValue());
|
||||
|
||||
rank = jedis.zrank("foo", "b");
|
||||
assertEquals(1, rank);
|
||||
assertEquals(1, rank.intValue());
|
||||
|
||||
rank = jedis.zrank("car", "b");
|
||||
assertNull(rank);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user