testcontainers-java icon indicating copy to clipboard operation
testcontainers-java copied to clipboard

test(postgresql): improve coverage for custom credentials configuration

Open spencerarq opened this issue 3 weeks ago • 0 comments

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 testCustomCredentials to PostgreSQLContainerTest.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%.

spencerarq avatar Nov 22 '25 01:11 spencerarq