Search in sources :

Example 1 with PhoneNumberType

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

the class PhoneDTOTest method phoneNumberNullValidationTest.

@Test
public void phoneNumberNullValidationTest() {
    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 2 with PhoneNumberType

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

the class PhoneDTOTest method phoneNumberValidationTestBlank.

@Test
public void phoneNumberValidationTestBlank() {
    PhoneDTO phone = new PhoneDTO();
    phone.setNumber(" ");
    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 3 with PhoneNumberType

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

the class PhoneDTOTest method phoneNumberNonDigitsValidationTest.

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

Example 4 with PhoneNumberType

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

the class PhoneDTOTest method phoneNumberMoreThan10digitsValidationTest.

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

Example 5 with PhoneNumberType

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

the class PhoneDTOTest method phoneNumberValidationTest.

@Test
public void phoneNumberValidationTest() {
    PhoneDTO phone = new PhoneDTO();
    phone.setNumber("1234567890");
    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)

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