Add tests to check returning null to pool
This commit is contained in:
@@ -45,6 +45,9 @@ public abstract class Pool<T> {
|
||||
}
|
||||
|
||||
public void returnResourceObject(final T resource) {
|
||||
if (resource == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
internalPool.returnObject(resource);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -198,4 +198,14 @@ public class JedisPoolTest extends Assert {
|
||||
pool.returnResource(jedis2);
|
||||
pool.destroy();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void returnNullObjectShouldNotFail() {
|
||||
JedisPool pool = new JedisPool(new JedisPoolConfig(), hnp.getHost(),
|
||||
hnp.getPort(), 2000, "foobared", 0, "my_shiny_client_name");
|
||||
|
||||
pool.returnBrokenResource(null);
|
||||
pool.returnResource(null);
|
||||
pool.returnResourceObject(null);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user