Search in sources :

Example 1 with JdbcUtils

use of com.alibaba.druid.util.JdbcUtils in project druid by alibaba.

the class JdbcUtilsTest method test_close.

public void test_close() throws Exception {
    JdbcUtils.close((Connection) null);
    JdbcUtils.close((Statement) null);
    JdbcUtils.close((ResultSet) null);
    JdbcUtils.close(new MockConnection() {

        @Override
        public void close() throws SQLException {
            throw new SQLException();
        }
    });
    JdbcUtils.close(new MockStatement(null) {

        @Override
        public void close() throws SQLException {
            throw new SQLException();
        }
    });
    JdbcUtils.close(new MockResultSet(null) {

        @Override
        public void close() throws SQLException {
            throw new SQLException();
        }
    });
    JdbcUtils.close(new Closeable() {

        @Override
        public void close() throws IOException {
            throw new IOException();
        }
    });
    JdbcUtils.close(new Closeable() {

        @Override
        public void close() throws IOException {
        }
    });
    JdbcUtils.close((Closeable) null);
    new JdbcUtils();
}
Also used : JdbcUtils(com.alibaba.druid.util.JdbcUtils) SQLException(java.sql.SQLException) Closeable(java.io.Closeable) MockStatement(com.alibaba.druid.mock.MockStatement) MockResultSet(com.alibaba.druid.mock.MockResultSet) IOException(java.io.IOException) MockConnection(com.alibaba.druid.mock.MockConnection)

Aggregations

MockConnection (com.alibaba.druid.mock.MockConnection)1 MockResultSet (com.alibaba.druid.mock.MockResultSet)1 MockStatement (com.alibaba.druid.mock.MockStatement)1 JdbcUtils (com.alibaba.druid.util.JdbcUtils)1 Closeable (java.io.Closeable)1 IOException (java.io.IOException)1 SQLException (java.sql.SQLException)1