Search in sources :

Example 41 with RFA1aFormDTO

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());
}
Also used : RFA1aFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO) ApplicantDTO(gov.ca.cwds.cals.service.dto.rfa.ApplicantDTO) ResidenceDTO(gov.ca.cwds.cals.service.dto.rfa.ResidenceDTO)

Example 42 with RFA1aFormDTO

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());
}
Also used : Response(javax.ws.rs.core.Response) RFA1aFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO) MinorChildDTO(gov.ca.cwds.cals.service.dto.rfa.MinorChildDTO) ApplicantDTO(gov.ca.cwds.cals.service.dto.rfa.ApplicantDTO) Test(org.junit.Test)

Example 43 with RFA1aFormDTO

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());
}
Also used : Response(javax.ws.rs.core.Response) RFA1aFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO) MinorChildDTO(gov.ca.cwds.cals.service.dto.rfa.MinorChildDTO) ApplicantDTO(gov.ca.cwds.cals.service.dto.rfa.ApplicantDTO) Test(org.junit.Test)

Example 44 with RFA1aFormDTO

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());
}
Also used : AdoptionHistoryDTO(gov.ca.cwds.cals.service.dto.rfa.AdoptionHistoryDTO) RFA1aFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO) Test(org.junit.Test)

Example 45 with RFA1aFormDTO

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);
    }
}
Also used : BaseExceptionResponse(gov.ca.cwds.rest.exception.BaseExceptionResponse) Set(java.util.Set) RFA1aFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO) IssueDetails(gov.ca.cwds.rest.exception.IssueDetails) ClientErrorException(javax.ws.rs.ClientErrorException) ApplicantDTO(gov.ca.cwds.cals.service.dto.rfa.ApplicantDTO) HashMap(java.util.HashMap) Map(java.util.Map) Test(org.junit.Test)

Aggregations

RFA1aFormDTO (gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO)59 Test (org.junit.Test)37 ApplicantDTO (gov.ca.cwds.cals.service.dto.rfa.ApplicantDTO)30 WebTarget (javax.ws.rs.client.WebTarget)19 IssueDetails (gov.ca.cwds.rest.exception.IssueDetails)15 Response (javax.ws.rs.core.Response)15 BaseExceptionResponse (gov.ca.cwds.rest.exception.BaseExceptionResponse)12 HashMap (java.util.HashMap)12 MinorChildDTO (gov.ca.cwds.cals.service.dto.rfa.MinorChildDTO)11 ClientErrorException (javax.ws.rs.ClientErrorException)11 Map (java.util.Map)10 Set (java.util.Set)10 StateType (gov.ca.cwds.cals.persistence.model.calsns.dictionaries.StateType)7 ResidenceDTO (gov.ca.cwds.cals.service.dto.rfa.ResidenceDTO)7 JsonProperty (com.fasterxml.jackson.annotation.JsonProperty)4 REQUIRED_APPLICANT_DATE_OF_BIRTH (gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_APPLICANT_DATE_OF_BIRTH)4 REQUIRED_APPLICANT_DRIVER_LICENSE_NUMBER (gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_APPLICANT_DRIVER_LICENSE_NUMBER)4 REQUIRED_APPLICANT_DRIVER_LICENSE_STATE (gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_APPLICANT_DRIVER_LICENSE_STATE)4 REQUIRED_APPLICANT_OTHER_NAMES_FIRST_NAME (gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_APPLICANT_OTHER_NAMES_FIRST_NAME)4 REQUIRED_APPLICANT_OTHER_NAMES_LAST_NAME (gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_APPLICANT_OTHER_NAMES_LAST_NAME)4