@Test public void connects_via_the_provided_datasource() throws SQLException { DataSource dataSource = mock(DataSource.class); Supplier<Connection> connectionProvider = new ConnectionConfigurationByDataSource( dataSource, Optional.<String>empty(), Optional.<String>empty() ); connectionProvider.get(); verify(dataSource).getConnection(); }
@Override public Connection get() { try { return connection(); } catch (SQLException e) { throw propagate(e); } }
ConnectionConfigurationByDataSource implements ConnectionConfiguration { @Override public Connection get() { try { return connection(); } catch (SQLException e) { throw propagate(e); } } }
ConnectionConfigurationByDataSource implements ConnectionConfiguration { @Override public Connection get() { try { return connection(); } catch (SQLException e) { throw propagate(e); } } ConnectionConfigurationByDataSource(DataSource dataSource,
                                               Optional<String> username,
                                               Optional<String> password); }
ConnectionConfigurationByDataSource implements ConnectionConfiguration { @Override public Connection get() { try { return connection(); } catch (SQLException e) { throw propagate(e); } } ConnectionConfigurationByDataSource(DataSource dataSource,
                                               Optional<String> username,
                                               Optional<String> password); @Override Connection get(); }
ConnectionConfigurationByDataSource implements ConnectionConfiguration { @Override public Connection get() { try { return connection(); } catch (SQLException e) { throw propagate(e); } } ConnectionConfigurationByDataSource(DataSource dataSource,
                                               Optional<String> username,
                                               Optional<String> password); @Override Connection get();  }