use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFA1aRequiredFieldsValidationTest method prepareEmptyForm.
private RFA1aFormDTO prepareEmptyForm() throws Exception {
RFA1aFormDTO form = formAHelper.createRFA1aForm();
ApplicantDTO applicant = applicantHelper.getValidApplicant();
applicant.setOtherNames(Collections.singletonList(new TypedPersonNameDTO()));
applicant.setDateOfBirth(null);
applicant.setDriverLicenseNumber("11111111");
applicant.setDriverLicenseState(null);
PhoneDTO phoneDTO = new PhoneDTO();
PhoneNumberType phoneNumberType = new PhoneNumberType();
phoneNumberType.setId(1L);
phoneNumberType.setValue("Cell");
phoneDTO.setPhoneType(phoneNumberType);
PhoneDTO secondaryPhoneDTO = new PhoneDTO();
secondaryPhoneDTO.setPhoneType(phoneNumberType);
applicant.setPhones(Arrays.asList(phoneDTO, secondaryPhoneDTO));
applicantHelper.postApplicant(form.getId(), applicant);
ResidenceDTO residenceDTO = residenceHelper.getResidenceDTO();
residenceDTO.setResidenceOwnership(null);
residenceDTO.setBodyOfWaterExist(null);
residenceDTO.setOthersUsingResidenceAsMailing(null);
residenceDTO.setPhysicalMailingSimilar(null);
residenceDTO.setWeaponInHome(null);
residenceDTO.setHomeLanguages(null);
// Create residential address
RFAAddressDTO residentialAddress = new RFAAddressDTO();
AddressType addressType = new AddressType();
addressType.setId(1L);
addressType.setValue("Residential");
residentialAddress.setType(addressType);
residenceDTO.setAddresses(Arrays.asList(// Resiadential address
residentialAddress, // Empty Address object
new RFAAddressDTO()));
residenceHelper.putResidence(form.getId(), residenceDTO);
return form;
}
use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFA1aRequiredFieldsValidationTest method requiredFieldsValidationOnSubmitTest.
@Test
public void requiredFieldsValidationOnSubmitTest() throws Exception {
RFA1aFormDTO form = prepareEmptyForm();
List<IssueDetails> cvIssues = getIssueDetails(form);
// First and Last Names are validated on save progress stage
// Assert.assertTrue(cvIssues.stream().anyMatch(id -> id.getCode().equals(REQUIRED_APPLICANT_FIRST_NAME)));// "CV000002";
// Assert.assertTrue(cvIssues.stream().anyMatch(id -> id.getCode().equals(REQUIRED_APPLICANT_LAST_NAME )));// "CV000003";
// "CV000004
Assert.assertTrue(cvIssues.stream().anyMatch(id -> id.getCode().equals(REQUIRED_APPLICANT_OTHER_NAMES_FIRST_NAME)));
// "CV000005"
Assert.assertTrue(cvIssues.stream().anyMatch(id -> id.getCode().equals(REQUIRED_APPLICANT_OTHER_NAMES_LAST_NAME)));
// "CV000006";
Assert.assertTrue(cvIssues.stream().anyMatch(id -> id.getCode().equals(REQUIRED_APPLICANT_DATE_OF_BIRTH)));
// "CV000007";
Assert.assertTrue(cvIssues.stream().anyMatch(id -> id.getCode().equals(REQUIRED_APPLICANT_DRIVER_LICENSE_STATE)));
// Assert.assertTrue(cvIssues.stream().anyMatch(id -> id.getCode().equals(REQUIRED_APPLICANT_DRIVER_LICENSE_NUMBER)));// "CV000008"); //see checkDriverLicenseNumberFormTest()
// "CV000009";
Assert.assertTrue(cvIssues.stream().anyMatch(id -> id.getCode().equals(REQUIRED_APPLICANT_PHONE_NUMBER)));
// Residence Card
// "CV000010";
Assert.assertTrue(cvIssues.stream().anyMatch(id -> id.getCode().equals(REQUIRED_RESIDENCE_STREET_ADDRESS)));
// "CV000011";
Assert.assertTrue(cvIssues.stream().anyMatch(id -> id.getCode().equals(REQUIRED_RESIDENCE_ADDRESS_CITY)));
// "CV000012";
Assert.assertTrue(cvIssues.stream().anyMatch(id -> id.getCode().equals(REQUIRED_RESIDENCE_ADDRESS_STATE)));
// "CV000013";
Assert.assertTrue(cvIssues.stream().anyMatch(id -> id.getCode().equals(REQUIRED_RESIDENCE_ADDRESS_ZIP)));
List<IssueDetails> streetIssues = cvIssues.stream().filter(issueDetails -> issueDetails.getCode().equals(REQUIRED_RESIDENCE_STREET_ADDRESS)).collect(Collectors.toList());
Assert.assertEquals(1, streetIssues.size());
List<IssueDetails> cityIssues = cvIssues.stream().filter(issueDetails -> issueDetails.getCode().equals(REQUIRED_RESIDENCE_ADDRESS_CITY)).collect(Collectors.toList());
Assert.assertEquals(1, cityIssues.size());
List<IssueDetails> stateIssues = cvIssues.stream().filter(issueDetails -> issueDetails.getCode().equals(REQUIRED_RESIDENCE_ADDRESS_STATE)).collect(Collectors.toList());
Assert.assertEquals(1, stateIssues.size());
List<IssueDetails> zipIssues = cvIssues.stream().filter(issueDetails -> issueDetails.getCode().equals(REQUIRED_RESIDENCE_ADDRESS_ZIP)).collect(Collectors.toList());
Assert.assertEquals(1, zipIssues.size());
// "CV000014";
Assert.assertTrue(cvIssues.stream().anyMatch(id -> id.getCode().equals(REQUIRED_PHYSICAL_MAILING_THE_SAME)));
// "CV000015";
Assert.assertTrue(cvIssues.stream().anyMatch(id -> id.getCode().equals(REQUIRED_RESIDENCE_OWNERSHIP)));
// "CV000016";
Assert.assertTrue(cvIssues.stream().anyMatch(id -> id.getCode().equals(REQUIRED_WEAPON_IN_HOME_FIELD)));
// "CV000017";
Assert.assertTrue(cvIssues.stream().anyMatch(id -> id.getCode().equals(REQUIRED_BODY_OF_WATER_EXIST_FIELD)));
// "CV000018";
Assert.assertTrue(cvIssues.stream().anyMatch(id -> id.getCode().equals(REQUIRED_OTHER_PEOPLE_IN_RESIDENCE)));
// "CV000019";
Assert.assertTrue(cvIssues.stream().anyMatch(id -> id.getCode().equals(REQUIRED_HOME_LANGUAGES)));
}
use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFA1aRequiredFieldsValidationTest method validateRequiredFieldsForMinorChild.
@Test
public void validateRequiredFieldsForMinorChild() throws Exception {
RFA1aFormDTO rfa1aForm = prepareValidForm();
ApplicantDTO firstApplicant = rfa1aForm.getFirstApplicant();
MinorChildDTO minorChild = buildEmptyMinorChild(firstApplicant);
minorChild.getRelationshipToApplicants().get(0).setApplicantId(null);
minorChild = minorChildHelper.postMinorChild(rfa1aForm.getId(), minorChild);
List<IssueDetails> cvIssues = getIssueDetails(rfa1aForm);
// "CV000020";
Assert.assertTrue(cvIssues.stream().anyMatch(id -> id.getCode().equals(REQUIRED_MINOR_CHILD_DATE_OF_BIRTH)));
// "CV000021";
Assert.assertTrue(cvIssues.stream().anyMatch(id -> id.getCode().equals(REQUIRED_MINOR_CHILD_GENDER)));
// "CV000022";
Assert.assertTrue(cvIssues.stream().anyMatch(id -> id.getCode().equals(REQUIRED_MINOR_CHILD_FINANCIALLY_SUPPORTED)));
// "CV000023";
Assert.assertTrue(cvIssues.stream().anyMatch(id -> id.getCode().equals(REQUIRED_MINOR_CHILD_ADOPTED)));
// "CV000024";
Assert.assertTrue(cvIssues.stream().anyMatch(id -> id.getCode().equals(REQUIRED_MINOR_CHILD_RELATIONSHIP_APPLICANT_ID)));
}
use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFA1aRequiredFieldsValidationTest method validateRequiredFieldsForMinorChildFulfilled.
@Test
public void validateRequiredFieldsForMinorChildFulfilled() throws Exception {
RFA1aFormDTO rfa1aForm = prepareValidForm();
ApplicantDTO firstApplicant = rfa1aForm.getFirstApplicant();
MinorChildDTO minorChild = minorChildHelper.buildNewMinorChildDTO(firstApplicant);
minorChild = minorChildHelper.postMinorChild(rfa1aForm.getId(), minorChild);
Response response = statusHelper.submitApplication(rfa1aForm.getId());
assertNotEquals(422, response.getStatus());
}
use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFA1aRequiredFieldsValidationTest method getIssueDetails.
private List<IssueDetails> getIssueDetails(RFA1aFormDTO form) {
Response response = statusHelper.submitApplication(form.getId());
assertEquals(422, response.getStatus());
IssueDetailesList issueDetailesList = response.readEntity(IssueDetailesList.class);
return issueDetailesList.getIssueDetails().stream().filter(issueDetails -> issueDetails.getCode().startsWith("CV")).collect(Collectors.toList());
}
Aggregations