Refactores primitive types in the API. Now int -> Integer and double -> Double.
This is to support Redis null values
This commit is contained in:
@@ -197,27 +197,27 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase {
|
||||
@Test
|
||||
public void flushDB() {
|
||||
jedis.set("foo", "bar");
|
||||
assertEquals(1, jedis.dbSize());
|
||||
assertEquals(1, jedis.dbSize().intValue());
|
||||
jedis.set("bar", "foo");
|
||||
jedis.move("bar", 1);
|
||||
String status = jedis.flushDB();
|
||||
assertEquals("OK", status);
|
||||
assertEquals(0, jedis.dbSize());
|
||||
assertEquals(0, jedis.dbSize().intValue());
|
||||
jedis.select(1);
|
||||
assertEquals(1, jedis.dbSize());
|
||||
assertEquals(1, jedis.dbSize().intValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void flushAll() {
|
||||
jedis.set("foo", "bar");
|
||||
assertEquals(1, jedis.dbSize());
|
||||
assertEquals(1, jedis.dbSize().intValue());
|
||||
jedis.set("bar", "foo");
|
||||
jedis.move("bar", 1);
|
||||
String status = jedis.flushAll();
|
||||
assertEquals("OK", status);
|
||||
assertEquals(0, jedis.dbSize());
|
||||
assertEquals(0, jedis.dbSize().intValue());
|
||||
jedis.select(1);
|
||||
assertEquals(0, jedis.dbSize());
|
||||
assertEquals(0, jedis.dbSize().intValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -226,7 +226,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase {
|
||||
assertTrue(jedis.ttl("foo") > 0);
|
||||
int status = jedis.persist("foo");
|
||||
assertEquals(1, status);
|
||||
assertEquals(-1, jedis.ttl("foo"));
|
||||
assertEquals(-1, jedis.ttl("foo").intValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -84,9 +84,9 @@ public class HashesCommandsTest extends JedisCommandTestBase {
|
||||
hash.put("car", "bar");
|
||||
jedis.hmset("foo", hash);
|
||||
|
||||
assertEquals(0, jedis.hexists("bar", "foo"));
|
||||
assertEquals(0, jedis.hexists("foo", "foo"));
|
||||
assertEquals(1, jedis.hexists("foo", "bar"));
|
||||
assertEquals(0, jedis.hexists("bar", "foo").intValue());
|
||||
assertEquals(0, jedis.hexists("foo", "foo").intValue());
|
||||
assertEquals(1, jedis.hexists("foo", "bar").intValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -96,9 +96,9 @@ public class HashesCommandsTest extends JedisCommandTestBase {
|
||||
hash.put("car", "bar");
|
||||
jedis.hmset("foo", hash);
|
||||
|
||||
assertEquals(0, jedis.hdel("bar", "foo"));
|
||||
assertEquals(0, jedis.hdel("foo", "foo"));
|
||||
assertEquals(1, jedis.hdel("foo", "bar"));
|
||||
assertEquals(0, jedis.hdel("bar", "foo").intValue());
|
||||
assertEquals(0, jedis.hdel("foo", "foo").intValue());
|
||||
assertEquals(1, jedis.hdel("foo", "bar").intValue());
|
||||
assertEquals(null, jedis.hget("foo", "bar"));
|
||||
}
|
||||
|
||||
@@ -109,8 +109,8 @@ public class HashesCommandsTest extends JedisCommandTestBase {
|
||||
hash.put("car", "bar");
|
||||
jedis.hmset("foo", hash);
|
||||
|
||||
assertEquals(0, jedis.hlen("bar"));
|
||||
assertEquals(2, jedis.hlen("foo"));
|
||||
assertEquals(0, jedis.hlen("bar").intValue());
|
||||
assertEquals(2, jedis.hlen("foo").intValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -27,10 +27,10 @@ public class ListCommandsTest extends JedisCommandTestBase {
|
||||
|
||||
@Test
|
||||
public void llen() {
|
||||
assertEquals(0, jedis.llen("foo"));
|
||||
assertEquals(0, jedis.llen("foo").intValue());
|
||||
jedis.lpush("foo", "bar");
|
||||
jedis.lpush("foo", "car");
|
||||
assertEquals(2, jedis.llen("foo"));
|
||||
assertEquals(2, jedis.llen("foo").intValue());
|
||||
}
|
||||
|
||||
@Test(expected = JedisException.class)
|
||||
@@ -80,7 +80,7 @@ public class ListCommandsTest extends JedisCommandTestBase {
|
||||
expected.add("2");
|
||||
|
||||
assertEquals("OK", status);
|
||||
assertEquals(2, jedis.llen("foo"));
|
||||
assertEquals(2, jedis.llen("foo").intValue());
|
||||
assertEquals(expected, jedis.lrange("foo", 0, 100));
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ public class ListCommandsTest extends JedisCommandTestBase {
|
||||
|
||||
assertEquals(2, count);
|
||||
assertEquals(expected, jedis.lrange("foo", 0, 1000));
|
||||
assertEquals(0, jedis.lrem("bar", 100, "foo"));
|
||||
assertEquals(0, jedis.lrem("bar", 100, "foo").intValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -175,11 +175,14 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
|
||||
jedis.zadd("foo", 0.1d, "c");
|
||||
jedis.zadd("foo", 2d, "a");
|
||||
|
||||
double score = jedis.zscore("foo", "b");
|
||||
Double score = jedis.zscore("foo", "b");
|
||||
assertEquals(10d, score);
|
||||
|
||||
score = jedis.zscore("foo", "c");
|
||||
assertEquals(0.1d, score);
|
||||
|
||||
score = jedis.zscore("foo", "s");
|
||||
assertNull(score);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -301,8 +304,8 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
|
||||
assertEquals(2, result);
|
||||
|
||||
Set<Tuple> expected = new LinkedHashSet<Tuple>();
|
||||
expected.add(new Tuple("b", 4));
|
||||
expected.add(new Tuple("a", 3));
|
||||
expected.add(new Tuple("b", new Double(4)));
|
||||
expected.add(new Tuple("a", new Double(3)));
|
||||
|
||||
assertEquals(expected, jedis.zrangeWithScores("dst", 0, 100));
|
||||
}
|
||||
@@ -322,8 +325,8 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
|
||||
assertEquals(2, result);
|
||||
|
||||
Set<Tuple> expected = new LinkedHashSet<Tuple>();
|
||||
expected.add(new Tuple("b", 8));
|
||||
expected.add(new Tuple("a", 6));
|
||||
expected.add(new Tuple("b", new Double(8)));
|
||||
expected.add(new Tuple("a", new Double(6)));
|
||||
|
||||
assertEquals(expected, jedis.zrangeWithScores("dst", 0, 100));
|
||||
}
|
||||
@@ -339,7 +342,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
|
||||
assertEquals(1, result);
|
||||
|
||||
Set<Tuple> expected = new LinkedHashSet<Tuple>();
|
||||
expected.add(new Tuple("a", 3));
|
||||
expected.add(new Tuple("a", new Double(3)));
|
||||
|
||||
assertEquals(expected, jedis.zrangeWithScores("dst", 0, 100));
|
||||
}
|
||||
@@ -358,7 +361,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
|
||||
assertEquals(1, result);
|
||||
|
||||
Set<Tuple> expected = new LinkedHashSet<Tuple>();
|
||||
expected.add(new Tuple("a", 6));
|
||||
expected.add(new Tuple("a", new Double(6)));
|
||||
|
||||
assertEquals(expected, jedis.zrangeWithScores("dst", 0, 100));
|
||||
}
|
||||
|
||||
@@ -173,6 +173,6 @@ public class StringValuesCommandsTest extends JedisCommandTestBase {
|
||||
@Test
|
||||
public void strlen() {
|
||||
jedis.set("s", "This is a string");
|
||||
assertEquals("This is a string".length(), jedis.strlen("s"));
|
||||
assertEquals("This is a string".length(), jedis.strlen("s").intValue());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user