@Test void connection() throws SQLException { when(dataSource.getConnection()).thenReturn(expected); Connection connection = DataSourceUtil.connection(dataSource); verify(dataSource).getConnection(); verifyNoMoreInteractions(dataSource); assertThat(connection, sameInstance(expected)); }
public static Connection connection(DataSource dataSource) { try { return dataSource.getConnection(); } catch (SQLException e) { throw new RuntimeSqlException(e); } }
DataSourceUtil extends UtilityClass { public static Connection connection(DataSource dataSource) { try { return dataSource.getConnection(); } catch (SQLException e) { throw new RuntimeSqlException(e); } } }
DataSourceUtil extends UtilityClass { public static Connection connection(DataSource dataSource) { try { return dataSource.getConnection(); } catch (SQLException e) { throw new RuntimeSqlException(e); } }  }
DataSourceUtil extends UtilityClass { public static Connection connection(DataSource dataSource) { try { return dataSource.getConnection(); } catch (SQLException e) { throw new RuntimeSqlException(e); } }  static Connection connection(DataSource dataSource); }
DataSourceUtil extends UtilityClass { public static Connection connection(DataSource dataSource) { try { return dataSource.getConnection(); } catch (SQLException e) { throw new RuntimeSqlException(e); } }  static Connection connection(DataSource dataSource);  }