DataSourceDestination implements Destination { @Override public Connection getConnection() throws SQLException { return dataSource.getConnection(); } DataSourceDestination(@Nonnull DataSource dataSource); static DataSourceDestination with(@Nonnull DataSource dataSource); @Override Connection getConnection(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void getConnectionWorks() throws SQLException { DataSource dataSource = mock(DataSource.class); Connection connection = mock(Connection.class); when(dataSource.getConnection()).thenReturn(connection); assertSame(connection, new DataSourceDestination(dataSource).getConnection()); }