use of com.alibaba.druid.pool.vendor.MockExceptionSorter in project druid by alibaba.
the class ExceptionSorterTest method test_exceptionSorter.
public void test_exceptionSorter() throws Exception {
Assert.assertTrue(dataSource.getExceptionSorterClassName(), dataSource.getExceptionSorter() instanceof MockExceptionSorter);
Connection conn = dataSource.getConnection();
MockConnection mockConn = conn.unwrap(MockConnection.class);
PreparedStatement stmt = conn.prepareStatement("select 1");
stmt.execute();
mockConn.close();
Exception stmtClosedError = null;
try {
stmt.close();
} catch (Exception ex) {
stmtClosedError = ex;
}
Assert.assertNotNull(stmtClosedError);
conn.close();
}
Aggregations