コード例 #1
0
 @Test
 public void determineDriver() {
   DataSourceProperties properties = new DataSourceProperties();
   properties.setUrl("jdbc:mysql://mydb");
   assertThat(properties.getDriverClassName()).isNull();
   assertThat(properties.determineDriverClassName()).isEqualTo("com.mysql.jdbc.Driver");
 }
コード例 #2
0
 @Test
 public void determineDriverWithExplicitConfig() {
   DataSourceProperties properties = new DataSourceProperties();
   properties.setUrl("jdbc:mysql://mydb");
   properties.setDriverClassName("org.hsqldb.jdbcDriver");
   assertThat(properties.getDriverClassName()).isEqualTo("org.hsqldb.jdbcDriver");
   assertThat(properties.determineDriverClassName()).isEqualTo("org.hsqldb.jdbcDriver");
 }