Subject: [pgjdbc/pgjdbc] PR #4113: test: make message assertions locale-independent

From: "vlsi (@vlsi)" <[email-masked]>
Date: Tue, 26 May 2026 12:01:01 +0000

## What

Make exception-message assertions in four tests locale-independent. Wrap the expected text in `GT.tr(...)` so the comparison matches whatever the JVM's default locale resolves the template to.

Affected tests:

- `org.postgresql.jdbc.ScramTest`
  - `invalidPasswords`: wraps the expected text in `GT.tr(...)`.
  - `rejectIterationCountAboveDefaultCap`: drops the locale-dependent `contains("exceeds")` assertion. The remaining checks (the `scramMaxIterations` property name and the locale-formatted iteration count) already pin the test to the iteration-cap error path.
- `org.postgresql.test.jdbc2.PreparedStatementTest.testBadBoolean`: uses `GT.tr("Cannot cast to boolean: \"{0}\"", value)` for the message-with-value cases. The two `assertEquals("Cannot cast to boolean", ...)` calls stay as raw English literals because the source throws that literal without `GT.tr`.
- `org.postgresql.test.jdbc2.ResultSetTest`
  - text-mode branch of `testBadBoolean`: uses `GT.tr(...)`.
  - binary-mode branch: derives the locale-specific prefix, middle, and suffix from the `"Cannot convert the column of type {0} to requested type {1}."` template via placeholder markers, then checks the actual message lines up.
  - `testgetBoolean`: wraps the `"2"` and `"2.0"` cases in `GT.tr(...)`.
- `org.postgresql.test.jdbc2.UpdateableResultTest`: wraps the three `"No eligible primary or unique key found for table …"` asserts in `GT.tr(...)`.

## Why

The CI matrix runs jobs with `ru_RU` and other non-English locales. Production code routes the affected messages through `GT.tr` at the throw site, so the JVM picks up the localised string from the gettext catalogue. Hard-coded English assertions fail on those jobs even though the behaviour is correct.

The run that surfaced this: https://github.com/pgjdbc/pgjdbc/actions/runs/26416335971. Fourteen cases failed across the four classes above.

The `GT.tr(...)` pattern is already used in `PreparedStatementTest.checkInfinityLiterals`, so the fix follows existing precedent.

## How to verify

- Run the CI matrix with `ru_RU`; the 14 previously failing cases should pass.
- Run the CI matrix with the default English locale; `GT.tr(template, args)` returns the English template when no translation matches, so the assertions continue to pass.

---

From: "vlsi (@vlsi)" <[email-masked]>
Date: Tue, 26 May 2026 13:08:24 +0000

The test change is needed for https://github.com/pgjdbc/pgjdbc/pull/1280
If there are no objections, I am going to merge the PR soon.

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Tue, 26 May 2026 15:42:25 +0000

(on pgjdbc/src/test/java/org/postgresql/jdbc/ScramTest.java:147)

if it were me, I'd use `received` instead of `got`. There is some historical precedence for got being an "ugly word" in the English language. But I'm not going to die on this hill

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Tue, 26 May 2026 15:42:35 +0000

LGTM