throw JedisDataException when sending NULL values to redis as it is not a valid value in the protocol

This commit is contained in:
Jonathan Leibiusky
2011-05-11 19:22:31 -03:00
parent cfc906167c
commit 0d6d37b95f
2 changed files with 11 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisShardInfo;
import redis.clients.jedis.Protocol;
import redis.clients.jedis.exceptions.JedisConnectionException;
import redis.clients.jedis.exceptions.JedisDataException;
import redis.clients.jedis.tests.commands.JedisCommandTestBase;
import redis.clients.util.SafeEncoder;
@@ -53,4 +54,9 @@ public class JedisTest extends JedisCommandTestBase {
Thread.sleep(20000);
jedis.hmget("foobar", "foo");
}
@Test(expected = JedisDataException.class)
public void failWhenSendingNullValues() {
jedis.set("foo", null);
}
}