Merge branch '1.3.x'
This commit is contained in:
@@ -33,6 +33,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.times;
|
||||
@@ -76,6 +77,14 @@ public class DevToolsDataSourceAutoConfigurationTests {
|
||||
verify(statement).execute("SHUTDOWN");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void configurationBacksOffWithoutDataSourceProperties() throws SQLException {
|
||||
ConfigurableApplicationContext context = createContext("org.h2.Driver",
|
||||
NoDataSourcePropertiesConfiguration.class);
|
||||
assertThat(context.getBeansOfType(DevToolsDataSourceAutoConfiguration.class))
|
||||
.isEmpty();
|
||||
}
|
||||
|
||||
private ConfigurableApplicationContext createContext(String driver,
|
||||
Class<?>... classes) {
|
||||
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
|
||||
@@ -108,4 +117,14 @@ public class DevToolsDataSourceAutoConfigurationTests {
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
static class NoDataSourcePropertiesConfiguration {
|
||||
|
||||
@Bean
|
||||
public DataSource in() {
|
||||
return mock(DataSource.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user