Search in sources :

Example 6 with MinorChildDTO

use of gov.ca.cwds.cals.service.dto.rfa.MinorChildDTO 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());
}
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 7 with MinorChildDTO

use of gov.ca.cwds.cals.service.dto.rfa.MinorChildDTO in project cals-api by ca-cwds.

the class RFA1aRequiredFieldsValidationTest method buildEmptyMinorChild.

private MinorChildDTO buildEmptyMinorChild(ApplicantDTO firstApplicant) throws IOException {
    MinorChildDTO minorChild = minorChildHelper.buildNewMinorChildDTO(firstApplicant);
    minorChild.setDateOfBirth(null);
    minorChild.setGender(null);
    minorChild.setChildFinanciallySupported(null);
    minorChild.setChildAdopted(null);
    return minorChild;
}
Also used : MinorChildDTO(gov.ca.cwds.cals.service.dto.rfa.MinorChildDTO)

Example 8 with MinorChildDTO

use of gov.ca.cwds.cals.service.dto.rfa.MinorChildDTO 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 9 with MinorChildDTO

use of gov.ca.cwds.cals.service.dto.rfa.MinorChildDTO 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 10 with MinorChildDTO

use of gov.ca.cwds.cals.service.dto.rfa.MinorChildDTO in project cals-api by ca-cwds.

the class MinorChildHelper method createMinorChildren.

public List<MinorChildDTO> createMinorChildren(Long formId, ApplicantDTO reletiveApplicant) throws Exception {
    List<MinorChildDTO> minorChildDTOs = new ArrayList<>(2);
    for (int i = 0; i < 2; i++) {
        MinorChildDTO minorChildDTO = buildNewMinorChildDTO(reletiveApplicant);
        minorChildDTO.setOtherRelativeFirstName(minorChildDTO.getOtherRelativeFirstName() + i);
        minorChildDTO.setOtherRelativeLastName(minorChildDTO.getOtherRelativeLastName() + i);
        minorChildDTOs.add(postMinorChild(formId, minorChildDTO));
    }
    return minorChildDTOs;
}
Also used : MinorChildDTO(gov.ca.cwds.cals.service.dto.rfa.MinorChildDTO) ArrayList(java.util.ArrayList)

Aggregations

MinorChildDTO (gov.ca.cwds.cals.service.dto.rfa.MinorChildDTO)12 RFA1aFormDTO (gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO)8 Test (org.junit.Test)7 ApplicantDTO (gov.ca.cwds.cals.service.dto.rfa.ApplicantDTO)6 Response (javax.ws.rs.core.Response)5 ResidenceDTO (gov.ca.cwds.cals.service.dto.rfa.ResidenceDTO)3 ArrayList (java.util.ArrayList)3 AdoptionHistoryDTO (gov.ca.cwds.cals.service.dto.rfa.AdoptionHistoryDTO)2 ApplicantsDeclarationDTO (gov.ca.cwds.cals.service.dto.rfa.ApplicantsDeclarationDTO)2 ApplicantsHistoryDTO (gov.ca.cwds.cals.service.dto.rfa.ApplicantsHistoryDTO)2 ApplicantsRelationshipDTO (gov.ca.cwds.cals.service.dto.rfa.ApplicantsRelationshipDTO)2 ChildDesiredDTO (gov.ca.cwds.cals.service.dto.rfa.ChildDesiredDTO)2 OtherAdultDTO (gov.ca.cwds.cals.service.dto.rfa.OtherAdultDTO)2 ReferencesDTO (gov.ca.cwds.cals.service.dto.rfa.ReferencesDTO)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 WebTarget (javax.ws.rs.client.WebTarget)2 Assert.assertEquals (org.junit.Assert.assertEquals)2 Assert.assertNotEquals (org.junit.Assert.assertNotEquals)2 BeforeClass (org.junit.BeforeClass)2