FINERACT-2792: Add integration test coverage for /v1/email CRUD lifecycle - #6360
Open
AshharAhmadKhan wants to merge 1 commit into
Open
FINERACT-2792: Add integration test coverage for /v1/email CRUD lifecycle#6360AshharAhmadKhan wants to merge 1 commit into
AshharAhmadKhan wants to merge 1 commit into
Conversation
AshharAhmadKhan
force-pushed
the
FINERACT-2792-email-integration-test
branch
from
August 31, 2026 20:21
d426e87 to
d2802fe
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)