DynamicallyPooledDatasourceSystemListener extends PooledDatasourceSystemListener { @Override protected DataSource getDataSource( IDatabaseConnection connection ) { DataSource ds = null; try { ds = getDatasourceService().getDataSource( connection.getName() ); } catch ( DBDatasourceServiceException | DriverNotInitializedException e ) { Logger.error( this, Messages.getInstance() .getErrorString( "DatasourceSystemListener.ERROR_0003_UNABLE_TO_POOL_DATASOURCE", connection.getName(), e.getMessage() ) ); } return ds; }  IDBDatasourceService getDatasourceService();  }
@Test public void testGetDataSource() { when( listener.getDatasourceService() ).thenReturn( new MockDataSourceService( false ) ); DataSource ds = listener.getDataSource( connection ); assertNotNull( ds ); }