testcontainers-java
testcontainers-java copied to clipboard
test(postgresql): improve coverage for custom credentials configuration
Description
This PR improves the test coverage for the PostgreSQLContainer class by validating the configuration of custom credentials (databaseName, username, password).
Context
Previous tests primarily covered default settings. Fluent configuration methods for custom credentials were identified as coverage gaps during analysis (red lines in coverage report).
Changes
- Added
testCustomCredentialstoPostgreSQLContainerTest.java. - This new test validates that:
- Fluent setters correctly update the container state.
- The generated JDBC URL contains the correct database name.
- The container successfully starts with non-default credentials.
Impact
- Line Coverage: Increased from 77% to ~97% for
PostgreSQLContainer.java. - Method Coverage: Increased from 66% to ~93%.