use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFA1aApplicantResourceTest method testEmptyFirstNameValidation.
@Test
public void testEmptyFirstNameValidation() throws Exception {
RFA1aFormDTO form = formAHelper.createRFA1aForm();
ApplicantDTO applicant = getApplicantDTO();
applicant.setFirstName(" ");
applicant.setLastName("setLastName");
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-empty-first-name-response.json", parameters);
}
}
use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFA1aApplicantResourceTest method postDuplicateApplicantMiddleNameValidationTest.
@Test
public void postDuplicateApplicantMiddleNameValidationTest() throws Exception {
try {
RFA1aFormDTO form = formAHelper.createRFA1aForm();
ApplicantDTO firstApplicant = applicantHelper.postApplicant(form.getId(), getApplicantDTO());
ApplicantDTO secondApplicant = getApplicantDTO();
secondApplicant.setMiddleName("differentName");
secondApplicant = applicantHelper.postApplicant(form.getId(), secondApplicant);
secondApplicant.setMiddleName(firstApplicant.getMiddleName());
putApplicant(form, secondApplicant);
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-name-violation-response.json", parameters);
}
}
use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFA1aApplicantResourceTest method testBlankPhonesAreNotDuplicated.
@Test
public void testBlankPhonesAreNotDuplicated() throws Exception {
RFA1aFormDTO form = formAHelper.createRFA1aForm();
ApplicantDTO applicant = getApplicantDTO();
applicant.getPhones().clear();
applicant.getPhones().add(createPhone(" ", " ", false, createPhoneNumberType()));
applicant.getPhones().add(createPhone(null, " ", false, createPhoneNumberType()));
assertNoSuchError(() -> applicantHelper.postApplicant(form.getId(), applicant), APPLICANT_PHONE_NUMBERS_DUPLICATION);
}
use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFA1aApplicantResourceTest method postDuplicateApplicantsValidationTest.
@Test
public void postDuplicateApplicantsValidationTest() throws Exception {
try {
RFA1aFormDTO form = formAHelper.createRFA1aForm();
applicantHelper.postApplicant(form.getId(), getApplicantDTO());
applicantHelper.postApplicant(form.getId(), getApplicantDTO());
fail();
} catch (ClientErrorException e) {
assertEquals(422, e.getResponse().getStatus());
}
}
use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFA1aApplicantResourceTest method postDuplicateApplicantLastNameValidationTest.
@Test
public void postDuplicateApplicantLastNameValidationTest() throws Exception {
try {
RFA1aFormDTO form = formAHelper.createRFA1aForm();
ApplicantDTO firstApplicant = applicantHelper.postApplicant(form.getId(), getApplicantDTO());
ApplicantDTO secondApplicant = getApplicantDTO();
secondApplicant.setLastName("differentName");
secondApplicant = applicantHelper.postApplicant(form.getId(), secondApplicant);
secondApplicant.setLastName(firstApplicant.getLastName());
putApplicant(form, secondApplicant);
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-name-violation-response.json", parameters);
}
}
Aggregations