mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
完善测试
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@817 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -67,7 +67,7 @@ public class PoolableStatement extends PoolableWrapper implements Statement {
|
||||
}
|
||||
}
|
||||
|
||||
void clearResultSet() {
|
||||
protected void clearResultSet() {
|
||||
for (ResultSet rs : resultSetTrace) {
|
||||
try {
|
||||
if (!rs.isClosed()) {
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.alibaba.druid.bvt.pool.basic;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import com.alibaba.druid.mock.MockResultSet;
|
||||
import com.alibaba.druid.pool.PoolableStatement;
|
||||
|
||||
public class PoolableStatementTest3 extends TestCase {
|
||||
|
||||
public void test_clearResultSetError() throws Exception {
|
||||
final MockResultSet rs = new MockResultSet(null) {
|
||||
public void close() throws SQLException {
|
||||
throw new SQLException();
|
||||
}
|
||||
};
|
||||
|
||||
PoolableStatement stmt = new PoolableStatement(null, null) {
|
||||
public void close() throws SQLException {
|
||||
resultSetTrace.add(rs);
|
||||
clearResultSet();
|
||||
}
|
||||
};
|
||||
stmt.close();
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user