Commit c94f0822 authored by Madhura Bhave's avatar Madhura Bhave

Fix bean names in tests

See gh-11224
parent 27922ae3
......@@ -48,12 +48,12 @@ public class CompleteTwoDataSourcesExampleTests {
public void validateConfiguration() throws SQLException {
assertThat(this.context.getBeansOfType(DataSource.class)).hasSize(2);
DataSource dataSource = this.context.getBean(DataSource.class);
assertThat(this.context.getBean("fooDataSource")).isSameAs(dataSource);
assertThat(this.context.getBean("firstDataSource")).isSameAs(dataSource);
assertThat(dataSource.getConnection().getMetaData().getURL())
.startsWith("jdbc:h2:mem:");
DataSource barDataSource = this.context.getBean("barDataSource",
DataSource secondDataSource = this.context.getBean("secondDataSource",
DataSource.class);
assertThat(barDataSource.getConnection().getMetaData().getURL())
assertThat(secondDataSource.getConnection().getMetaData().getURL())
.startsWith("jdbc:h2:mem:");
}
......
......@@ -38,8 +38,8 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Stephane Nicoll
*/
@RunWith(SpringRunner.class)
@SpringBootTest(properties = { "app.datasource.bar.url=jdbc:h2:mem:bar;DB_CLOSE_DELAY=-1",
"app.datasource.bar.max-total=42" })
@SpringBootTest(properties = { "app.datasource.second.url=jdbc:h2:mem:bar;DB_CLOSE_DELAY=-1",
"app.datasource.second.max-total=42" })
@Import(SimpleTwoDataSourcesExample.SimpleDataSourcesConfiguration.class)
public class SimpleTwoDataSourcesExampleTests {
......@@ -50,13 +50,13 @@ public class SimpleTwoDataSourcesExampleTests {
public void validateConfiguration() throws SQLException {
assertThat(this.context.getBeansOfType(DataSource.class)).hasSize(2);
DataSource dataSource = this.context.getBean(DataSource.class);
assertThat(this.context.getBean("fooDataSource")).isSameAs(dataSource);
assertThat(this.context.getBean("firstDataSource")).isSameAs(dataSource);
assertThat(dataSource.getConnection().getMetaData().getURL())
.startsWith("jdbc:h2:mem:");
BasicDataSource barDataSource = this.context.getBean("barDataSource",
BasicDataSource secondDataSource = this.context.getBean("secondDataSource",
BasicDataSource.class);
assertThat(barDataSource.getUrl()).isEqualTo("jdbc:h2:mem:bar;DB_CLOSE_DELAY=-1");
assertThat(barDataSource.getMaxTotal()).isEqualTo(42);
assertThat(secondDataSource.getUrl()).isEqualTo("jdbc:h2:mem:bar;DB_CLOSE_DELAY=-1");
assertThat(secondDataSource.getMaxTotal()).isEqualTo(42);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment