Skip to content

Commit

Permalink
Do not permit blank CHILD_SUPPORT_AGENCY_CALCULATION
Browse files Browse the repository at this point in the history
  • Loading branch information
al-hmcts committed Jul 1, 2024
1 parent 8789a03 commit cc49882
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import uk.gov.hmcts.reform.bsp.common.model.shared.in.InputScannedDoc;
import uk.gov.hmcts.reform.bsp.common.model.validation.out.OcrValidationResult;
import uk.gov.hmcts.reform.bsp.common.service.BulkScanFormValidator;
import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.Gender;

import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -19,7 +20,6 @@

import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;
import static org.apache.commons.lang3.StringUtils.EMPTY;
import static uk.gov.hmcts.reform.bsp.common.model.validation.BulkScanValidationPatterns.CCD_EMAIL_REGEX;
import static uk.gov.hmcts.reform.bsp.common.model.validation.BulkScanValidationPatterns.CCD_PHONE_NUMBER_REGEX;
import static uk.gov.hmcts.reform.bsp.common.service.validation.PostcodeValidator.validatePostcode;
Expand Down Expand Up @@ -149,15 +149,17 @@ public class FormAValidator extends BulkScanFormValidator {
));
ALLOWED_VALUES_PER_FIELD.put(CHILD_SUPPORT_AGENCY_CALCULATION_MADE, asList(
"Yes",
"No",
EMPTY
"No"
));
ALLOWED_VALUES_PER_FIELD.put(AUTHORISATION_SIGNED_BY, asList(
"Applicant",
"Litigation Friend",
"Applicant's solicitor"
));
final List<String> genderEnum = asList("Male", "Female", EMPTY);
final List<String> genderEnum = asList(
Gender.MALE.getValue(),
Gender.FEMALE.getValue()
);
ALLOWED_VALUES_PER_FIELD.put(GENDER_CHILD_1, genderEnum);
ALLOWED_VALUES_PER_FIELD.put(GENDER_CHILD_2, genderEnum);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public void shouldTransformFieldsAccordingly() {
}

@Test
public void shouldEmptyChildGenderIsNotGiven() {
public void shouldTransformEmptyChildGenderIsNotGiven() {
ExceptionRecord incomingExceptionRecord = createExceptionRecord(asList(
new OcrDataField(OcrFieldName.NAME_CHILD_1, "Bilbo Baggins"),
new OcrDataField(OcrFieldName.GENDER_CHILD_1, ""),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,16 +268,16 @@ public void shouldFailFieldsHavingInvalidValues() {
"to meet expenses incurred by a child in being educated or training for work",
"when either the child or the person with care of the child "
+ "or the absent parent of the child is not habitually resident in the United Kingdom"),
CHILD_SUPPORT_AGENCY_CALCULATION_MADE + " must be \"Yes\", \"No\" or left blank",
CHILD_SUPPORT_AGENCY_CALCULATION_MADE + " must be \"Yes\" or \"No\"",
mustBeOneOf(AUTHORISATION_SIGNED_BY,
"Applicant",
"Litigation Friend",
"Applicant's solicitor"),
AUTHORISATION_DATE + " must be a valid date",
DATE_OF_BIRTH_CHILD_1 + " must be a valid date",
DATE_OF_BIRTH_CHILD_2 + " must be a valid date",
GENDER_CHILD_1 + " must be \"Male\", \"Female\" or left blank",
GENDER_CHILD_2 + " must be \"Male\", \"Female\" or left blank",
GENDER_CHILD_1 + " must be \"Male\" or \"Female\"",
GENDER_CHILD_2 + " must be \"Male\" or \"Female\"",
mandatoryFieldIsMissing.apply(APPLICANT_ADDRESS_LINE_1),
mandatoryFieldIsMissing.apply(APPLICANT_ADDRESS_POSTCODE),
mandatoryFieldIsMissing.apply(RESPONDENT_ADDRESS_LINE_1),
Expand Down

0 comments on commit cc49882

Please sign in to comment.