@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"); }
@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"); }