完善mock和测试

git-svn-id: http://code.alibabatech.com/svn/druid/trunk@832 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
wenshao
2011-09-18 03:46:16 +00:00
parent 5e1c3238a4
commit 8f8b09275e
2 changed files with 10 additions and 1 deletions
@@ -36,7 +36,8 @@ public class ConnectionTest5 extends TestCase {
dataSource.setMinEvictableIdleTimeMillis(300 * 1000); // 300 / 10
dataSource.setTimeBetweenEvictionRunsMillis(180 * 1000); // 180 / 10
dataSource.setTestWhileIdle(true);
dataSource.setTestOnBorrow(false);
dataSource.setTestOnBorrow(true);
dataSource.setTestOnReturn(true);
dataSource.setValidationQuery("SELECT 1");
dataSource.setFilters("stat,trace");
@@ -15,4 +15,12 @@ public class PoolableWrapperTest extends TestCase {
Assert.assertEquals(true, wrapper.isWrapperFor(PoolableWrapper.class));
Assert.assertEquals(true, wrapper.isWrapperFor(MockConnection.class));
}
public void test_unwrap() throws Exception {
PoolableWrapper wrapper = new PoolableWrapper(new MockConnection());
Assert.assertEquals(null, wrapper.unwrap(null));
Assert.assertEquals(true, wrapper.unwrap(PoolableWrapper.class) != null);
Assert.assertEquals(true, wrapper.unwrap(MockConnection.class) != null);
}
}