@ -26,9 +26,12 @@ import javax.sql.DataSource;
import com.zaxxer.hikari.HikariDataSource ;
import com.zaxxer.hikari.HikariDataSource ;
import org.apache.commons.dbcp2.BasicDataSource ;
import org.apache.commons.dbcp2.BasicDataSource ;
import org.h2.Driver ;
import org.junit.jupiter.api.AfterEach ;
import org.junit.jupiter.api.AfterEach ;
import org.junit.jupiter.api.Test ;
import org.junit.jupiter.api.Test ;
import org.springframework.jdbc.datasource.SimpleDriverDataSource ;
import static org.assertj.core.api.Assertions.assertThat ;
import static org.assertj.core.api.Assertions.assertThat ;
/ * *
/ * *
@ -74,6 +77,14 @@ class DataSourceBuilderTests {
assertThat ( hikariDataSource ) . isInstanceOf ( HikariDataSource . class ) ;
assertThat ( hikariDataSource ) . isInstanceOf ( HikariDataSource . class ) ;
}
}
@Test
void dataSourceCanBeCreatedWithSimpleDriverDataSource ( ) {
this . dataSource = DataSourceBuilder . create ( ) . url ( "jdbc:h2:test" ) . type ( SimpleDriverDataSource . class ) . build ( ) ;
assertThat ( this . dataSource ) . isInstanceOf ( SimpleDriverDataSource . class ) ;
assertThat ( ( ( SimpleDriverDataSource ) this . dataSource ) . getUrl ( ) ) . isEqualTo ( "jdbc:h2:test" ) ;
assertThat ( ( ( SimpleDriverDataSource ) this . dataSource ) . getDriver ( ) ) . isInstanceOf ( Driver . class ) ;
}
final class HidePackagesClassLoader extends URLClassLoader {
final class HidePackagesClassLoader extends URLClassLoader {
private final String [ ] hiddenPackages ;
private final String [ ] hiddenPackages ;