Skip to content

be: cover the Czech text and the holder's delegates, so a regression fails the build, not a caller #73

Closed

Description

@landsman

The suite is strong where the library has rules (paging, JSON shapes, failures, configuration) and thin where it has promises. Four paths a regression would reach a caller through have no test, and for the first one the fixtures already hold the data.

1. The Czech text is in the fixtures and asserted nowhere

live/pending-incoming.json carries "unstructured": "Okamžitá platba" and live/booked.json carries "OKAMŽITÁ ÚHRADA", and no test compares either. MonetaClientTest.aPendingMovementHasOnlyTheDateItWasEntered reads that fixture and checks status, amount and dates only.

get() decodes with BodyHandlers.ofString(), which takes the charset from Content-Type and falls back to UTF-8. A charset added in the test server's respond(), or sent by MONETA, would mojibake every name and message and the suite would stay green. This is the one I would close first: it needs no new fixture.

  • assertEquals("Okamžitá platba", pending.message()) in that test
  • the same for a booked movement, OKAMŽITÁ ÚHRADA in message() or in raw()

2. AccountHolder's delegates

Only transactions(), tokenExpiry() and the new account() (#72) are called by a test. transactions(String), balance(), balance(String) and accounts() have no caller at all, so a copy-paste slip such as balance(String accountId) calling onlyAccountId() would pass, and the three exceptions balance() documents are never exercised.

  • me.balance("acc-2") asks for /acc-2/balance
  • me.balance() on a two-account token is IllegalStateException
  • me.accounts() and me.transactions("acc-2") reach the paths they name

3. Kotlin nullability of account(iban)

testing/kotlin/src/test/kotlin/example/kotlin/KotlinCallerTest.kt exists to pin JSpecify for Kotlin callers, and usage.md shows me.account(storedIban) ?: return refuse(). The new @Nullable return is unpinned, so a dropped annotation would compile for Java and only bite a Kotlin caller.

  • me.account("…") ?: … compiles
  • me.account("…").id does not

4. Method.OTHER and reversed()

llms.txt tells callers that Transaction.Method gains constants and to keep a default branch. Nothing tests that the library itself keeps that promise: an unknown clearingSystemReference mapping to OTHER in TransactionJson.method() is untested. reversalIndicator: true is never exercised either; reversed() is only ever asserted false.

  • a movement with an unknown clearingSystemReference is OTHER and the code stays in raw()
  • reversalIndicator: true gives reversed()

When the edges matter

  • The IBAN lookup (be: find a token's account by its iban, so a caller with several accounts needs no moneta id #72): null throws, and a dash does not match while usage.md says it does not. If a mod-97 check lands, a typo is refused rather than read as revoked.
  • Money: negate() is public and untested, and Currency.getInstance("XXX") has getDefaultFractionDigits() == -1, which is the Math.max(…, 0) branch in the compact constructor.
  • balance() on a two-account token throws IllegalStateException, mirroring aQueryWithoutAnAccountRefusesATokenWithTwo.

Not doing

  • A concurrency stress test for the "thread-safe" promise. There is no shared mutable state beyond one volatile field, so it would guard a future regression rather than find a bug now.
  • Coverage chasing. The build has no JaCoCo or Kover, so this list came from reading the code. If the question should be answered mechanically next time, adding Kover to build.gradle.kts is cheaper than more tests.

Done when

  • the four above are in, each failing on the code before it
  • the edge list is either written or dropped with a line saying why

Activity

  1. added
    enhancementNew feature or request
    javaPull requests that update java code
    on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestjavaPull requests that update java code

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions