完善mock和测试

git-svn-id: http://code.alibabatech.com/svn/druid/trunk@829 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
wenshao
2011-09-18 03:21:00 +00:00
parent a2b245c57c
commit 40ab2d3d3a
@@ -3,6 +3,9 @@ package com.alibaba.druid.bvt.pool.basic;
import java.sql.SQLException;
import java.util.Properties;
import javax.sql.ConnectionEvent;
import javax.sql.ConnectionEventListener;
import junit.framework.Assert;
import junit.framework.TestCase;
@@ -129,6 +132,37 @@ public class ConnectionTest5 extends TestCase {
Assert.assertEquals(true, conn.isClosed());
}
public void test_handleException_5() throws Exception {
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
conn.addConnectionEventListener(new ConnectionEventListener() {
@Override
public void connectionClosed(ConnectionEvent event) {
}
@Override
public void connectionErrorOccurred(ConnectionEvent event) {
}
});
conn.getConnection().close();
{
SQLException error = null;
try {
conn.handleException(new RuntimeException());
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
conn.close();
}
public void test_setClientInfo() throws Exception {
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);