Replace Closer class to use its close() method

This commit is contained in:
Jungtaek Lim
2014-09-10 21:15:02 +09:00
parent c0697cd6d7
commit f931a4fc81
5 changed files with 19 additions and 68 deletions

View File

@@ -1,10 +1,5 @@
package redis.clients.jedis.tests;
import java.io.Closeable;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -15,37 +10,35 @@ import redis.clients.jedis.exceptions.JedisConnectionException;
public class ConnectionCloseTest extends Assert {
private final Closer closer = new Closer();
private Connection client;
@Before
public void setUp() throws Exception {
client = closer.register(new Connection());
client = new Connection();
}
@After
public void tearDown() throws Exception {
closer.close();
client.close();
}
@Test(expected = JedisConnectionException.class)
public void checkUnkownHost() {
client.setHost("someunknownhost");
client.connect();
client.setHost("someunknownhost");
client.connect();
}
@Test(expected = JedisConnectionException.class)
public void checkWrongPort() {
client.setHost("localhost");
client.setPort(55665);
client.connect();
client.setHost("localhost");
client.setPort(55665);
client.connect();
}
@Test
public void connectIfNotConnectedWhenSettingTimeoutInfinite() {
client.setHost("localhost");
client.setPort(6379);
client.setTimeoutInfinite();
client.setHost("localhost");
client.setPort(6379);
client.setTimeoutInfinite();
}
}