use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFA1aRequiredFieldsValidationTest method prepareValidForm.
private RFA1aFormDTO prepareValidForm() throws Exception {
RFA1aFormDTO form = formAHelper.createRFA1aForm();
ApplicantDTO applicant = applicantHelper.getValidApplicant();
applicantHelper.postApplicant(form.getId(), applicant);
ResidenceDTO residenceDTO = residenceHelper.getResidenceDTO();
residenceHelper.putResidence(form.getId(), residenceDTO);
return formAHelper.getRFA1aForm(form.getId());
}
use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFA1aRequiredFieldsValidationTest method validateRequiredFieldsForMinorChildWhenRelationshipsIsNull.
@Test
public void validateRequiredFieldsForMinorChildWhenRelationshipsIsNull() throws Exception {
RFA1aFormDTO rfa1aForm = prepareValidForm();
ApplicantDTO firstApplicant = rfa1aForm.getFirstApplicant();
MinorChildDTO minorChild = buildEmptyMinorChild(firstApplicant);
minorChild.setRelationshipToApplicants(null);
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 validateRequiredFieldsForMinorChildWhenRelationshipsIsEmpty.
@Test
public void validateRequiredFieldsForMinorChildWhenRelationshipsIsEmpty() throws Exception {
RFA1aFormDTO rfa1aForm = prepareValidForm();
ApplicantDTO firstApplicant = rfa1aForm.getFirstApplicant();
MinorChildDTO minorChild = buildEmptyMinorChild(firstApplicant);
minorChild.setRelationshipToApplicants(Collections.emptyList());
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 RFA1aAdoptionHistoryResourceTest method checkSetNullIsPossible.
@Test
public void checkSetNullIsPossible() throws Exception {
RFA1aFormDTO form = formAHelper.createRFA1aForm();
AdoptionHistoryDTO adoptionHistoryDTO = adoptionHistoryHelper.getAdoptionHistory("fixtures/rfa/rfa-1a-adoption-history-small.json");
adoptionHistoryHelper.putAdoptionHistory(form.getId(), adoptionHistoryDTO);
adoptionHistoryDTO = adoptionHistoryHelper.getAdoptionHistory(form.getId());
assertNull(adoptionHistoryDTO.getFosterCareLicensesQ1().isWasPreviouslyLicensed());
assertNull(adoptionHistoryDTO.getApplicationsForAdoptionQ2().isHaveAppliedForAdoption());
assertNull(adoptionHistoryDTO.getFacilityOperationLicensesQ3().isWasPreviouslyLicensed());
assertNull(adoptionHistoryDTO.getEmploymentInFacilitiesQ4().isWasEmployedOrVolunteered());
assertNull(adoptionHistoryDTO.getDenialHistoryQ5().isHadDenials());
assertNull(adoptionHistoryDTO.getSuspensionRevocationHistoryQ6().isHadSuspensionsRevocations());
assertNull(adoptionHistoryDTO.isWasSubjectForExclusionOrderQ7());
}
use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFA1aApplicantResourceTest method testDuplicatePhoneNumbers.
@Test
public void testDuplicatePhoneNumbers() throws Exception {
RFA1aFormDTO form = formAHelper.createRFA1aForm();
ApplicantDTO applicant = getApplicantDTO();
applicant.getPhones().clear();
applicant.getPhones().add(createPhoneNoExtension());
applicant.getPhones().add(createPhoneNoExtension());
try {
applicantHelper.postApplicant(form.getId(), applicant);
fail();
} catch (ClientErrorException e) {
assertEquals(422, e.getResponse().getStatus());
String entity = e.getResponse().readEntity(String.class);
Map<String, Object> parameters = new HashMap<>();
BaseExceptionResponse exceptionResponse = e.getResponse().readEntity(BaseExceptionResponse.class);
Set<IssueDetails> issueDetails = exceptionResponse.getIssueDetails();
IssueDetails detail = issueDetails.iterator().next();
parameters.put("incident_id", detail.getIncidentId());
assertResponseByFixtureTemplate(entity, "fixtures/rfa/validation/applicant-duplicate-phone-numbers-response.json", parameters);
}
}
Aggregations