Skip to content

test: complete unit test coverage of typed Spot REST operations - #107

Merged
nyg merged 1 commit into
masterfrom
nyg/unit-test-coverage-84ce91
Sep 21, 2026
Merged

nyg merged 1 commit into
masterfrom
nyg/unit-test-coverage-84ce91

Conversation

@nyg

@nyg nyg commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Adds unit tests for the 21 typed operations that had none, so all 76 Spot REST operations tracked in #82 are now covered by a test of request encoding and response mapping against a Kraken fixture.

Tests

  • Market Data: Time, SystemStatus, Assets, AssetPairs and Ticker get endpoint tests (URL and query parameters, fixture decoding, lookup by name and alternate name, fee tiers, restricted asset statuses, unknown enum values) and routing tests in MarketDataTest.
  • Account Data: Ledgers, QueryLedgers, AddExport, ExportStatus, RetrieveExport and RemoveExport get endpoint tests and routing tests in KrakenAPIAccountTest. Ledger tests cover date bounds taking precedence over ledger identifiers, paging with withNextResultOffset(), entry identifiers carried by asList(), staking reward filtering and full pages. RetrieveExport is tested on an in-memory ZIP archive holding a ledger CSV, both through processZipResponse and through DefaultKrakenRestRequester with an application/zip response.
  • Subaccounts: CreateSubaccount and AccountTransfer, with routing tests in the new KrakenAPISubaccountTest.
  • Earn: all six operations, including indexed lock_type[n] parameters, bonded strategies with their periods as Duration, allocations in every state with a payout period, and pending statuses, with routing tests in the new KrakenAPIEarnTest.
  • Transparency: PreTrade and PostTrade, including nanosecond timestamps reused as the next from_ts, with routing tests in the new KrakenAPITransparencyTest.

Fixtures are the response examples of the OpenAPI spec 1.1.0, retrieved on 2026-09-21. PreTrade and PostTrade have no documented example, so their fixtures are assembled from the property examples of the response schemas. Each fixture directory has a README describing its sources and supplemental inline cases. The library suite goes from 453 to 589 tests.

Fixes found by the tests

  • Report.subType was always null: Kraken sends subtype, and the component had no @JsonProperty.
  • SystemStatus.Description and Report.Status were package-private although returned by public record accessors, so callers could not compare status() against a constant. Both are now public and documented.

Not covered here

These gaps showed up while checking the spec and are left for follow-ups:

  • The SystemStatus record ignores the upcoming_maintenance and emergency arrays the endpoint now returns.
  • LedgerInfoParams and LedgerEntriesParams don't expose the rebase_multiplier parameter of Ledgers and QueryLedgers.
  • PostTradeParams requires a symbol, while the spec makes it optional and returns the last 1000 trades of all pairs without one.
  • The spec declares RetrieveExport as application/octet-stream, while DefaultKrakenRestRequester only reads archives served as application/zip.

Validation

mvnd -B clean package passes with 589 tests, and javadoc:jar with the release profile's doclint settings passes on the two changed records. No test calls the Kraken API or needs API keys.

@nyg
nyg merged commit 008e2c4 into master Sep 21, 2026
1 check passed
@nyg
nyg deleted the nyg/unit-test-coverage-84ce91 branch September 21, 2026 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant