Skip to content

FINERACT-2792: Add integration test coverage for /v1/email CRUD lifecycle - #6360

Merged
adamsaghy merged 1 commit into
apache:developfrom
AshharAhmadKhan:FINERACT-2792-email-integration-test
Sep 1, 2026
Merged

FINERACT-2792: Add integration test coverage for /v1/email CRUD lifecycle#6360
adamsaghy merged 1 commit into
apache:developfrom
AshharAhmadKhan:FINERACT-2792-email-integration-test

Conversation

@AshharAhmadKhan

Copy link
Copy Markdown
Contributor

Description

/v1/email has zero test coverage at any layer, no unit tests for EmailApiResource, no integration tests in integration-tests, no E2E coverage. This was true even after FINERACT-2782 (missing UPDATE handler), FINERACT-2785 (validator checking wrong constants), and FINERACT-2786 (NPE on CREATE) were all found and fixed independently, purely through manual/code inspection rather than any failing test.

All three of the above bugs made /v1/email CREATE and UPDATE completely unusable in production, yet none were caught by CI. A single integration test exercising the real HTTP layer end to end would have caught all three, the validator bug and NPE on the first CREATE call, and the missing handler on the first UPDATE call.

This PR adds that test.

Changes

Added EmailTest.java to integration-tests, covering:

testEmailCreateRetrieveUpdateDeleteLifecycle() — full CREATE → RETRIEVE → UPDATE → DELETE → RETRIEVE-after-delete (404) flow, against a client with a real emailAddress, since EmailMessageAssembler derives the recipient from the linked client/staff record.

testEmailCreateWithStaffIdOnlyDoesNotThrow() - confirms staffId alone (no clientId) satisfies validation, per the either.clientId.or.staffId.must.be.provided rule in EmailDataValidator.

testEmailCreateWithoutClientOrStaffIdFails() - confirms the same rule rejects requests missing both.

Verified locally end to end

See https://issues.apache.org/jira/browse/FINERACT-2792

Related

#6325 (missing UPDATE command handler, merged)
#6330 (validator constants bug, merged)
#6331 (NPE on CREATE, merged)

@AshharAhmadKhan
AshharAhmadKhan force-pushed the FINERACT-2792-email-integration-test branch from d426e87 to d2802fe Compare August 31, 2026 20:21
@AshharAhmadKhan

Copy link
Copy Markdown
Contributor Author

Hey @adamsaghy , please let me know if you would like any changes

@adamsaghy adamsaghy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@adamsaghy
adamsaghy merged commit 868ea20 into apache:develop Sep 1, 2026
91 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.

2 participants