Skip to content

[Feature] Add jsonrpc-test-utils module with reusable JsonRpcAssertions #26

@limehee

Description

@limehee

Problem statement

JSON-RPC tests repeatedly assert the same protocol patterns (success response shape, error code expectations, notification no-response behavior). This leads to duplicated assertions and lower readability across modules and downstream adopters.

Proposed solution

Add a dedicated jsonrpc-test-utils module with reusable assertion helpers, for example:

  • assertSuccess(response)
  • assertErrorCode(response, expectedCode)
  • assertNotificationNoResponse(dispatchResult)
  • optional batch helpers for count and per-id checks

Design goals:

  • concise and intention-revealing test code
  • reusable across jsonrpc-core, spring-webmvc, samples, and external projects
  • no runtime dependency impact for production artifacts

Alternatives considered

  • Continue using local ad-hoc assertion methods in each test class
  • Publish only copy-paste snippets in docs

These options keep duplication and inconsistency.

JSON-RPC behavior impact

No protocol behavior change. This is test support only.

Additional context

  • Keep the module lightweight and JUnit 5 friendly.
  • Provide examples in sample tests.
  • Ensure assertions cover both single and batch response scenarios.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: waiting-for-feedbackWaiting for additional information from reporter or stakeholders.type: featureNew feature specification and implementation.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions