use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFA1aPrintPDFTest method getDocumentIdTest.
@Ignore
@Test
public void getDocumentIdTest() throws Exception {
// For integration test only
if (!TestModeUtils.isIntegrationTestsMode()) {
return;
}
RFA1aFormDTO form = createRfa1aFormDTO();
WebTarget target = clientTestRule.target(API.RFA_1A_FORMS + "/" + form.getId() + "/documentId");
String documentId = target.request().get(String.class);
assertNotNull(documentId);
}
use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFA1aRequiredFieldsValidationTest method checkDriverLicenseNumberFormTest.
@Test
public void checkDriverLicenseNumberFormTest() throws Exception {
RFA1aFormDTO form = prepareValidForm();
ApplicantDTO applicant = applicantHelper.getValidApplicant();
applicant.setFirstName("Some");
applicant.setDriverLicenseNumber("");
StateType driverLicenseState = new StateType();
driverLicenseState.setId("CA");
driverLicenseState.setValue("California");
applicant.setDriverLicenseState(driverLicenseState);
applicantHelper.postApplicant(form.getId(), applicant);
List<IssueDetails> cvIssues = getIssueDetails(form);
// "CV000008");
Assert.assertTrue(cvIssues.stream().anyMatch(id -> id.getCode().equals(REQUIRED_APPLICANT_DRIVER_LICENSE_NUMBER)));
}
use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class LIC198bResourceTest method getLIC198bFormApplicantTest.
@Test
public void getLIC198bFormApplicantTest() throws Exception {
RFA1aFormDTO form1a = formAHelper.createRFA1aForm();
LIC198bFormDTO created = getExternalEntityApiHelper().createEntity(form1a);
ApplicantDTO applicantDTO = applicantHelper.getFirstExistedOrPostNewApplicant(form1a.getId(), applicantHelper.getValidApplicant());
WebTarget target = clientTestRule.target(API.RFA_1A_FORMS + "/" + form1a.getId() + "/" + getExternalEntityApiHelper().getConfiguration().getApiPath() + "/" + API.RFA_1A_APPLICANTS + "/" + applicantDTO.getId());
LIC198bFormDTO found = target.request().get(getExternalEntityApiHelper().getConfiguration().getEntityClass());
assertThat(found).isEqualTo(created);
}
use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class LIC198bResourceTest method getExternalEntityApiHelper.
@Override
protected BaseExternalEntityApiHelper<LIC198bFormDTO> getExternalEntityApiHelper() {
TestExternalEntityConfiguration<LIC198bFormDTO> configuration = new TestExternalEntityConfiguration<LIC198bFormDTO>(clientTestRule, LIC198bFormDTO.class, API.LIC_198B_FORMS) {
@Override
protected String getFixture() {
return LIC198B_FORM_FIXTURE;
}
@Override
public GenericType<CollectionDTO<LIC198bFormDTO>> getCollectionDTOGenericType() {
return new GenericType<CollectionDTO<LIC198bFormDTO>>() {
};
}
@Override
public void modifyEntity(LIC198bFormDTO lic198bFormDTO) {
lic198bFormDTO.getIdentifyingData().getPersonName().setFirstName("Petya");
}
};
return new BaseExternalEntityApiHelper<LIC198bFormDTO>(clientTestRule, configuration, formAHelper) {
@Override
public LIC198bFormDTO createEntity(RFA1aFormDTO form) throws IOException {
ApplicantDTO applicantDTO = applicantHelper.getFirstExistedOrPostNewApplicant(form.getId(), applicantHelper.getValidApplicant());
WebTarget target = clientTestRule.target(API.RFA_1A_FORMS + "/" + form.getId() + "/" + configuration.getApiPath() + "/" + API.RFA_1A_APPLICANTS + "/" + applicantDTO.getId());
LIC198bFormDTO entity = configuration.createEntity();
return target.request(MediaType.APPLICATION_JSON).post(Entity.entity(entity, MediaType.APPLICATION_JSON_TYPE), configuration.getEntityClass());
}
};
}
use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFA1aApplicantResourceTest method testEmptyLastNameValidation.
@Test
public void testEmptyLastNameValidation() throws Exception {
RFA1aFormDTO form = formAHelper.createRFA1aForm();
ApplicantDTO applicant = getApplicantDTO();
applicant.setFirstName("setFirstName");
applicant.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-last-name-response.json", parameters);
}
}
Aggregations