Search in sources :

Example 6 with PhoneNumberType

use of gov.ca.cwds.cals.persistence.model.calsns.dictionaries.PhoneNumberType in project cals-api by ca-cwds.

the class PhoneDTOTest method phoneExtensionNullValidationTest.

@Test
public void phoneExtensionNullValidationTest() {
    PhoneDTO phone = new PhoneDTO();
    phone.setPhoneType(new PhoneNumberType());
    Set<ConstraintViolation<PhoneDTO>> violations = removeDbSessionViolation(validate(phone));
    assertTrue(violations.isEmpty());
}
Also used : ConstraintViolation(javax.validation.ConstraintViolation) PhoneNumberType(gov.ca.cwds.cals.persistence.model.calsns.dictionaries.PhoneNumberType) Test(org.junit.Test)

Example 7 with PhoneNumberType

use of gov.ca.cwds.cals.persistence.model.calsns.dictionaries.PhoneNumberType in project cals-api by ca-cwds.

the class RFA1aRequiredFieldsValidationTest method prepareEmptyForm.

private RFA1aFormDTO prepareEmptyForm() throws Exception {
    RFA1aFormDTO form = formAHelper.createRFA1aForm();
    ApplicantDTO applicant = applicantHelper.getValidApplicant();
    applicant.setOtherNames(Collections.singletonList(new TypedPersonNameDTO()));
    applicant.setDateOfBirth(null);
    applicant.setDriverLicenseNumber("11111111");
    applicant.setDriverLicenseState(null);
    PhoneDTO phoneDTO = new PhoneDTO();
    PhoneNumberType phoneNumberType = new PhoneNumberType();
    phoneNumberType.setId(1L);
    phoneNumberType.setValue("Cell");
    phoneDTO.setPhoneType(phoneNumberType);
    PhoneDTO secondaryPhoneDTO = new PhoneDTO();
    secondaryPhoneDTO.setPhoneType(phoneNumberType);
    applicant.setPhones(Arrays.asList(phoneDTO, secondaryPhoneDTO));
    applicantHelper.postApplicant(form.getId(), applicant);
    ResidenceDTO residenceDTO = residenceHelper.getResidenceDTO();
    residenceDTO.setResidenceOwnership(null);
    residenceDTO.setBodyOfWaterExist(null);
    residenceDTO.setOthersUsingResidenceAsMailing(null);
    residenceDTO.setPhysicalMailingSimilar(null);
    residenceDTO.setWeaponInHome(null);
    residenceDTO.setHomeLanguages(null);
    // Create residential address
    RFAAddressDTO residentialAddress = new RFAAddressDTO();
    AddressType addressType = new AddressType();
    addressType.setId(1L);
    addressType.setValue("Residential");
    residentialAddress.setType(addressType);
    residenceDTO.setAddresses(Arrays.asList(// Resiadential address
    residentialAddress, // Empty Address object
    new RFAAddressDTO()));
    residenceHelper.putResidence(form.getId(), residenceDTO);
    return form;
}
Also used : RFAAddressDTO(gov.ca.cwds.cals.service.dto.rfa.RFAAddressDTO) RFA1aFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO) TypedPersonNameDTO(gov.ca.cwds.cals.service.dto.rfa.TypedPersonNameDTO) ApplicantDTO(gov.ca.cwds.cals.service.dto.rfa.ApplicantDTO) ResidenceDTO(gov.ca.cwds.cals.service.dto.rfa.ResidenceDTO) PhoneDTO(gov.ca.cwds.cals.service.dto.rfa.PhoneDTO) AddressType(gov.ca.cwds.cals.persistence.model.calsns.dictionaries.AddressType) PhoneNumberType(gov.ca.cwds.cals.persistence.model.calsns.dictionaries.PhoneNumberType)

Example 8 with PhoneNumberType

use of gov.ca.cwds.cals.persistence.model.calsns.dictionaries.PhoneNumberType in project cals-api by ca-cwds.

the class PhoneDTOTest method phoneExtensionValidationTest.

@Test
public void phoneExtensionValidationTest() {
    PhoneDTO phone = new PhoneDTO();
    phone.setExtension("1234567");
    phone.setPhoneType(new PhoneNumberType());
    Set<ConstraintViolation<PhoneDTO>> violations = removeDbSessionViolation(validate(phone));
    assertTrue(violations.isEmpty());
}
Also used : ConstraintViolation(javax.validation.ConstraintViolation) PhoneNumberType(gov.ca.cwds.cals.persistence.model.calsns.dictionaries.PhoneNumberType) Test(org.junit.Test)

Example 9 with PhoneNumberType

use of gov.ca.cwds.cals.persistence.model.calsns.dictionaries.PhoneNumberType in project cals-api by ca-cwds.

the class PhoneDTOTest method phoneExtensionMoreThen7ValidationTest.

@Test
public void phoneExtensionMoreThen7ValidationTest() {
    PhoneDTO phone = new PhoneDTO();
    phone.setExtension("12345678");
    phone.setPhoneType(new PhoneNumberType());
    Set<ConstraintViolation<PhoneDTO>> violations = removeDbSessionViolation(validate(phone));
    assertEquals(violations.size(), 1);
    String actualMessage = violations.iterator().next().getMessage();
    String expectedMessage = getBetweenLengthMessage(0, 7);
    assertEquals(expectedMessage, actualMessage);
}
Also used : ConstraintViolation(javax.validation.ConstraintViolation) PhoneNumberType(gov.ca.cwds.cals.persistence.model.calsns.dictionaries.PhoneNumberType) Test(org.junit.Test)

Example 10 with PhoneNumberType

use of gov.ca.cwds.cals.persistence.model.calsns.dictionaries.PhoneNumberType in project cals-api by ca-cwds.

the class PhoneDTOTest method phoneExtensionHasNonDigitCharsValidationTest.

@Test
public void phoneExtensionHasNonDigitCharsValidationTest() {
    PhoneDTO phone = new PhoneDTO();
    String extension = "a";
    phone.setExtension(extension);
    phone.setPhoneType(new PhoneNumberType());
    Set<ConstraintViolation<PhoneDTO>> violations = removeDbSessionViolation(validate(phone));
    assertEquals(violations.size(), 1);
    String actualMessage = violations.iterator().next().getMessage();
    String expectedMessage = getNumericMessage(extension);
    assertEquals(expectedMessage, actualMessage);
}
Also used : ConstraintViolation(javax.validation.ConstraintViolation) PhoneNumberType(gov.ca.cwds.cals.persistence.model.calsns.dictionaries.PhoneNumberType) Test(org.junit.Test)

Aggregations

PhoneNumberType (gov.ca.cwds.cals.persistence.model.calsns.dictionaries.PhoneNumberType)13 ConstraintViolation (javax.validation.ConstraintViolation)11 Test (org.junit.Test)11 AddressType (gov.ca.cwds.cals.persistence.model.calsns.dictionaries.AddressType)1 ApplicantDTO (gov.ca.cwds.cals.service.dto.rfa.ApplicantDTO)1 PhoneDTO (gov.ca.cwds.cals.service.dto.rfa.PhoneDTO)1 RFA1aFormDTO (gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO)1 RFAAddressDTO (gov.ca.cwds.cals.service.dto.rfa.RFAAddressDTO)1 ResidenceDTO (gov.ca.cwds.cals.service.dto.rfa.ResidenceDTO)1 TypedPersonNameDTO (gov.ca.cwds.cals.service.dto.rfa.TypedPersonNameDTO)1