Skip to content

SPRDT-987 cover remaining move-to-past-date reject scenarios#40

Merged
ozturkmenb merged 1 commit into
team/pasthearingsfrom
dev/SPRDT-987-port-remaining-reject-tests
Jul 14, 2026
Merged

SPRDT-987 cover remaining move-to-past-date reject scenarios#40
ozturkmenb merged 1 commit into
team/pasthearingsfrom
dev/SPRDT-987-port-remaining-reject-tests

Conversation

@ozturkmenb

Copy link
Copy Markdown

Summary

Ports the two move-hearing-to-past-date reject scenarios that until now only existed as black-box tests in cpp-apitests (MoveHearingToPastDateIT on team/pasthearings there), completing listing-side reject coverage for the command:

Scenario Test added Level
Weekend-only range (no sitting day) → 422 INVALID_DATE_RANGE ListingCommandApiTest.shouldRejectMoveWhenRangeContainsNoSittingDay Unit — pure date logic in workingDaysBetween()
Missing mandatory startTime → 400 MoveHearingToPastDateIT.shouldRejectMoveWith400WhenStartTimeMissing (+ whenHearingIsMovedWithMissingStartTime() step) IT — schema rejection happens in the framework interceptor, before the handler

Test-only change; no production code touched.

With this merged, every reject scenario of the move contract is covered in this repo, and the remaining deterministic reject tests in cpp-apitests (see hmcts/cpp-apitests#468) can be deleted.

Verification

  • mvn clean install — BUILD SUCCESS (ListingCommandApiTest 42/42)
  • ./runIntegrationTests.sh — 235 tests, 0 failures, 0 errors, 3 skipped (exit 0); MoveHearingToPastDateIT 13/13 in both full-suite runs
  • sonarcheck.sh — quality gate passed

Note: an earlier full-suite run hit a pre-existing flake in HearingCsvReportIT.initialize (court-calendar judiciary projection poll timing out at 30s while the view still served the pre-update judge). It failed twice (full suite + solo) and passed twice (baseline without this diff in 1.7s + final full suite) with identical production code — unrelated to this test-only change, but worth a look given it's the same court-calendar area as SPRDT-1164.

Ports the last two move-hearing-to-past-date reject scenarios that only
existed as black-box tests in cpp-apitests, so listing-side coverage is
complete and the apitests deterministic tier can eventually be deleted:

- ListingCommandApiTest.shouldRejectMoveWhenRangeContainsNoSittingDay:
  a Saturday..Sunday span passes date validation but expands to zero
  sitting days -> 422 INVALID_DATE_RANGE with the no-sitting-day message.
  Unit level because the rule is pure date logic in workingDaysBetween().

- MoveHearingToPastDateIT.shouldRejectMoveWith400WhenStartTimeMissing:
  startTime omitted -> schema 400. IT level because the framework's JSON
  schema interceptor rejects before the handler runs, so a unit test
  cannot reach it. Mirrors the existing missing courtCentreId/courtRoomId
  tests via a new whenHearingIsMovedWithMissingStartTime() step.
@ozturkmenb ozturkmenb requested a review from a team as a code owner July 14, 2026 10:43
@cpp-github-management

Copy link
Copy Markdown

Passed

@ozturkmenb ozturkmenb merged commit f425ff4 into team/pasthearings Jul 14, 2026
3 checks passed
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