@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
/ *
* Copyright 2012 - 2020 the original author or authors .
* Copyright 2012 - 2021 the original author or authors .
*
* Licensed under the Apache License , Version 2 . 0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
@ -30,6 +30,7 @@ import oracle.jdbc.pool.OracleDataSource;
@@ -30,6 +30,7 @@ import oracle.jdbc.pool.OracleDataSource;
import oracle.ucp.jdbc.PoolDataSourceImpl ;
import org.apache.commons.dbcp2.BasicDataSource ;
import org.h2.Driver ;
import org.h2.jdbcx.JdbcDataSource ;
import org.junit.jupiter.api.AfterEach ;
import org.junit.jupiter.api.Test ;
@ -119,6 +120,15 @@ class DataSourceBuilderTests {
@@ -119,6 +120,15 @@ class DataSourceBuilderTests {
assertThat ( upcDataSource . getUser ( ) ) . isEqualTo ( "test" ) ;
}
@Test
void dataSourceCanBeCreatedWithH2JdbcDataSource ( ) {
this . dataSource = DataSourceBuilder . create ( ) . url ( "jdbc:h2:test" ) . type ( JdbcDataSource . class ) . username ( "test" )
. build ( ) ;
assertThat ( this . dataSource ) . isInstanceOf ( JdbcDataSource . class ) ;
JdbcDataSource h2DataSource = ( JdbcDataSource ) this . dataSource ;
assertThat ( h2DataSource . getUser ( ) ) . isEqualTo ( "test" ) ;
}
@Test
void dataSourceAliasesAreOnlyAppliedToRelevantDataSource ( ) {
this . dataSource = DataSourceBuilder . create ( ) . url ( "jdbc:h2:test" ) . type ( TestDataSource . class ) . username ( "test" )