mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
ignore Closed Connection error, fix #3836
This commit is contained in:
@@ -15,10 +15,14 @@
|
||||
*/
|
||||
package com.alibaba.druid.bvt.utils;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.sql.SQLRecoverableException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.alibaba.druid.mock.MockConnection;
|
||||
import com.alibaba.druid.mock.MockStatement;
|
||||
import org.junit.Assert;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
@@ -78,5 +82,14 @@ public class JdbcUtilsTest extends TestCase {
|
||||
List<Map<String, Object>> list = JdbcUtils.executeQuery(dataSource, "select * from user");
|
||||
Assert.assertEquals(0, list.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void test_close() throws Exception {
|
||||
MockStatement stmt = new MockStatement(new MockConnection()) {
|
||||
public void close() throws SQLException {
|
||||
throw new SQLRecoverableException("Closed Connection");
|
||||
}
|
||||
};
|
||||
JdbcUtils.close(stmt);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user