@Test public void shouldDelegateGetConnectionWithUsernameAndPassword() throws Exception { Connection connection = mock(Connection.class); String username = "username"; String password = "password"; given(delegate.getConnection(username, password)).willReturn(connection); assertThat(dataSource.getConnection(username, password), is(connection)); }
public Connection getConnection() throws SQLException { return getTargetDataSource().getConnection(); }
DelegatingDataSource implements DataSource, InitializingBean { public Connection getConnection() throws SQLException { return getTargetDataSource().getConnection(); } }
DelegatingDataSource implements DataSource, InitializingBean { public Connection getConnection() throws SQLException { return getTargetDataSource().getConnection(); } DelegatingDataSource();  DelegatingDataSource(DataSource targetDataSource); }
DelegatingDataSource implements DataSource, InitializingBean { public Connection getConnection() throws SQLException { return getTargetDataSource().getConnection(); } DelegatingDataSource();  DelegatingDataSource(DataSource targetDataSource); void setTargetDataSource(DataSource targetDataSource); DataSource getTargetDataSource(); void afterPropertiesSet(); Connection getConnection(); Connection getConnection(String username, String password); PrintWriter getLogWriter(); void setLogWriter(PrintWriter out); int getLoginTimeout(); void setLoginTimeout(int seconds); @SuppressWarnings("unchecked") T unwrap(Class<T> iface); boolean isWrapperFor(Class<?> iface); Logger getParentLogger(); }
DelegatingDataSource implements DataSource, InitializingBean { public Connection getConnection() throws SQLException { return getTargetDataSource().getConnection(); } DelegatingDataSource();  DelegatingDataSource(DataSource targetDataSource); void setTargetDataSource(DataSource targetDataSource); DataSource getTargetDataSource(); void afterPropertiesSet(); Connection getConnection(); Connection getConnection(String username, String password); PrintWriter getLogWriter(); void setLogWriter(PrintWriter out); int getLoginTimeout(); void setLoginTimeout(int seconds); @SuppressWarnings("unchecked") T unwrap(Class<T> iface); boolean isWrapperFor(Class<?> iface); Logger getParentLogger();  }