Skip to content

DTSPB-5217 added validation for checking dob and dod#3709

Open
justiceia wants to merge 21 commits intomasterfrom
DTSPB-5217
Open

DTSPB-5217 added validation for checking dob and dod#3709
justiceia wants to merge 21 commits intomasterfrom
DTSPB-5217

Conversation

@justiceia
Copy link
Copy Markdown
Contributor

JIRA link (if applicable)

https://tools.hmcts.net/jira/browse/DTSPB-5217

Change description

added validation for dod and dob so when exception comes in it'll throw exception if fails validation

Does this PR introduce a breaking change? (check one with "x")

[ ] Yes
[x] No

@justiceia justiceia self-assigned this Mar 18, 2026
@github-actions
Copy link
Copy Markdown

CCD diff report

No change


ExceptionRecordCaseDataValidator.validateIhtValues(grantOfRepresentationData);

ExceptionRecordCaseDataValidator.validateDateOfDeath(grantOfRepresentationData);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

moved because i added new line which made checkstylemain fail because modifiedFields was too far away from declaration and first usage

@github-actions
Copy link
Copy Markdown

CCD diff report

No change

@github-actions
Copy link
Copy Markdown

CCD diff report

No change

@github-actions
Copy link
Copy Markdown

CCD diff report

No change

1 similar comment
@github-actions
Copy link
Copy Markdown

CCD diff report

No change

@github-actions
Copy link
Copy Markdown

CCD diff report

No change

@github-actions
Copy link
Copy Markdown

CCD diff report

No change


public static void validateDateOfDeath(GrantOfRepresentationData caseData) {
List<String> errorMessages = new ArrayList<>();
if (caseData.getDeceasedDateOfBirth() != null && caseData.getDeceasedDateOfDeath() != null) {
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.

so we only check if the date of death is in the future if we also have a date of birth?

if (!caseData.getDeceasedDateOfDeath().isAfter(caseData.getDeceasedDateOfBirth())) {
errorMessages.add(DOD_BEFORE_DOB);
}
if (caseData.getDeceasedDateOfDeath().isAfter(LocalDate.now())) {
Copy link
Copy Markdown
Contributor

@tom-saunders-cts tom-saunders-cts Mar 24, 2026

Choose a reason for hiding this comment

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

generally prefer to use the LocalDate.now(Clock) implementation which allows for control of time in testing (we're sort of solving this the other way by making the test use a dynamic date of death)

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 8, 2026

CCD diff report

No change

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 8, 2026

CCD diff report

No change

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 8, 2026

CCD diff report

No change

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 9, 2026

CCD diff report

No change

@github-actions
Copy link
Copy Markdown

CCD diff report

No change

@github-actions
Copy link
Copy Markdown

CCD diff report

No change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants