### Question:
ShardingDataSource extends AbstractDataSourceAdapter implements AutoCloseable { @Override public ShardingConnection getConnection() throws SQLException { MetricsContext.init(shardingProperties); return new ShardingConnection(shardingContext); } ShardingDataSource(final ShardingRule shardingRule);  ShardingDataSource(final ShardingRule shardingRule, final Properties props); @Override ShardingConnection getConnection(); @Override void close();  }### Answer:
@Test public void assertGetConnection() throws SQLException { Connection connection = mockConnection(); DataSource dataSource = mock(DataSource.class); when(dataSource.getConnection()).thenReturn(connection); assertThat(createShardingDataSource(dataSource).getConnection().getConnection("ds", SQLType.DQL), is(connection)); }