Add tests to check returning null to pool

This commit is contained in:
Jonathan Leibiusky
2014-03-12 10:31:22 -04:00
parent f35567cc9f
commit 62b98a3e63
2 changed files with 13 additions and 0 deletions

View File

@@ -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) {

View File

@@ -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);
}
}