Untitled
unknown
plain_text
24 days ago
1.8 kB
3
Indexable
Never
package pl.santander.bancassurance.comparison.policy.domain; import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties; import org.springframework.jdbc.core.JdbcTemplate; import static org.junit.jupiter.api.Assertions.*; class DomainConfigurationTest { private final DomainConfiguration configuration = new DomainConfiguration(); @Test void testHikariConfig() { HikariConfig hikariConfig = configuration.hikariConfig(); assertNotNull(hikariConfig); } @Test void testDataSourceProperties() { DataSourceProperties properties = configuration.dataSourceProperties(); assertNotNull(properties); } @Test void testDataSource() { HikariDataSource dataSource = configuration.dataSource(); assertNotNull(dataSource); // Verify that the HikariConfig properties are set assertEquals(configuration.hikariConfig().getConnectionTimeout(), dataSource.getConnectionTimeout()); assertEquals(configuration.hikariConfig().getIdleTimeout(), dataSource.getIdleTimeout()); assertEquals(configuration.hikariConfig().getMaxLifetime(), dataSource.getMaxLifetime()); assertEquals(configuration.hikariConfig().getMaximumPoolSize(), dataSource.getMaximumPoolSize()); assertEquals(configuration.hikariConfig().getMinimumIdle(), dataSource.getMinimumIdle()); } @Test void testJdbcTemplate() { JdbcTemplate jdbcTemplate = configuration.jdbcTemplate(); assertNotNull(jdbcTemplate); assertNotNull(jdbcTemplate.getDataSource()); assertTrue(jdbcTemplate.getDataSource() instanceof HikariDataSource); } }
Leave a Comment