mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
完善mock和测试
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@834 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -208,5 +208,67 @@ public class DataSourceTest3 extends TestCase {
|
||||
Assert.assertNotNull(error);
|
||||
}
|
||||
}
|
||||
|
||||
public void test_getValidConnectionCheckerClassName() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
|
||||
conn.close();
|
||||
|
||||
dataSource.getValidConnectionCheckerClassName();
|
||||
}
|
||||
|
||||
public void test_setConnectionInitSqls() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
|
||||
conn.close();
|
||||
|
||||
dataSource.setConnectionInitSqls(null);
|
||||
}
|
||||
|
||||
public void test_setConnectionProperties() throws Exception {
|
||||
dataSource.setConnectionProperties(null);
|
||||
dataSource.setLogWriter(null);
|
||||
dataSource.getLogWriter();
|
||||
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
|
||||
conn.close();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void test_error_10() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
|
||||
conn.close();
|
||||
|
||||
{
|
||||
Exception error = null;
|
||||
try {
|
||||
dataSource.addConnectionProperty("x", "11");
|
||||
} catch (Exception ex) {
|
||||
error = ex;
|
||||
}
|
||||
Assert.assertNotNull(error);
|
||||
}
|
||||
}
|
||||
|
||||
public void test_error_11() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
|
||||
conn.close();
|
||||
|
||||
dataSource.getUrl();
|
||||
|
||||
{
|
||||
Exception error = null;
|
||||
try {
|
||||
dataSource.setUrl("x");
|
||||
} catch (Exception ex) {
|
||||
error = ex;
|
||||
}
|
||||
Assert.assertNotNull(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user