@Test void closeQuietlyConnection() throws SQLException { Connection connection = Mockito.mock(Connection.class); JdbcUtil.closeQuietly(connection); Mockito.verify(connection) .close(); }
public static void closeQuietly(ResultSet resultSet) { if (resultSet == null) { return; } try { resultSet.close(); } catch (SQLException e) { logSQLException(e); LOGGER.warn(Messages.COULD_NOT_CLOSE_RESULT_SET, e); } catch (Exception e) { LOGGER.warn(Messages.COULD_NOT_CLOSE_RESULT_SET, e); } }
JdbcUtil { public static void closeQuietly(ResultSet resultSet) { if (resultSet == null) { return; } try { resultSet.close(); } catch (SQLException e) { logSQLException(e); LOGGER.warn(Messages.COULD_NOT_CLOSE_RESULT_SET, e); } catch (Exception e) { LOGGER.warn(Messages.COULD_NOT_CLOSE_RESULT_SET, e); } } }
JdbcUtil { public static void closeQuietly(ResultSet resultSet) { if (resultSet == null) { return; } try { resultSet.close(); } catch (SQLException e) { logSQLException(e); LOGGER.warn(Messages.COULD_NOT_CLOSE_RESULT_SET, e); } catch (Exception e) { LOGGER.warn(Messages.COULD_NOT_CLOSE_RESULT_SET, e); } } private  JdbcUtil(); }
JdbcUtil { public static void closeQuietly(ResultSet resultSet) { if (resultSet == null) { return; } try { resultSet.close(); } catch (SQLException e) { logSQLException(e); LOGGER.warn(Messages.COULD_NOT_CLOSE_RESULT_SET, e); } catch (Exception e) { LOGGER.warn(Messages.COULD_NOT_CLOSE_RESULT_SET, e); } } private  JdbcUtil(); static void closeQuietly(ResultSet resultSet); static void closeQuietly(Statement statement); static void closeQuietly(Connection connection); static void logSQLException(SQLException exception); static void commit(Connection connection); static void rollback(Connection connection); }
JdbcUtil { public static void closeQuietly(ResultSet resultSet) { if (resultSet == null) { return; } try { resultSet.close(); } catch (SQLException e) { logSQLException(e); LOGGER.warn(Messages.COULD_NOT_CLOSE_RESULT_SET, e); } catch (Exception e) { LOGGER.warn(Messages.COULD_NOT_CLOSE_RESULT_SET, e); } } private  JdbcUtil(); static void closeQuietly(ResultSet resultSet); static void closeQuietly(Statement statement); static void closeQuietly(Connection connection); static void logSQLException(SQLException exception); static void commit(Connection connection); static void rollback(Connection connection);  }