Check jedis is connected before executing commands

This commit is contained in:
Jonathan Leibiusky
2010-06-15 23:28:19 -03:00
parent 0920223ef2
commit dc07d70e7a
4 changed files with 22 additions and 3 deletions

View File

@@ -0,0 +1,14 @@
package redis.clients.jedis.tests;
import org.junit.Test;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisException;
public class JedisTest {
@Test(expected = JedisException.class)
public void useWithoutConnecting() throws JedisException {
Jedis jedis = new Jedis("localhost");
jedis.dbSize();
}
}

View File

@@ -8,6 +8,7 @@ import org.junit.Ignore;
import org.junit.Test;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisException;
public class ConnectionHandlingCommandsTest extends Assert {
private Jedis jedis;
@@ -25,7 +26,7 @@ public class ConnectionHandlingCommandsTest extends Assert {
}
@Test
public void quit() {
public void quit() throws JedisException {
jedis.quit();
}