@Test public void validateCorrectPhoneNumber() throws Exception { ValidatorsTestSuite.assertValidationResultOK(validator, validator.validate("123-456-7890")); ValidatorsTestSuite.assertValidationResultOK(validator, validator.validate("123.456.7890")); ValidatorsTestSuite.assertValidationResultOK(validator, validator.validate("123 456 7890")); ValidatorsTestSuite.assertValidationResultOK(validator, validator.validate("(123) 456 7890")); ValidatorsTestSuite.assertValidationResultOK( validator, validator.validate("+1 (123) 456-7890")); ValidatorsTestSuite.assertValidationResultOK(validator, validator.validate("1-123-456-7890")); ValidatorsTestSuite.assertValidationResultOK(validator, validator.validate("11234567890")); }
@Test public void validateIncorrectPhoneNumber() throws Exception { ValidatorsTestSuite.assertValidationResultERROR(validator, validator.validate("123-456")); ValidatorsTestSuite.assertValidationResultERROR( validator, validator.validate("123..456..7890")); ValidatorsTestSuite.assertValidationResultERROR( validator, validator.validate("1234567890123456")); ValidatorsTestSuite.assertValidationResultERROR( validator, validator.validate("((123)) 456 7890")); ValidatorsTestSuite.assertValidationResultERROR( validator, validator.validate("-1 (123) 456-7890")); ValidatorsTestSuite.assertValidationResultERROR(validator, validator.validate("00000")); }
@Test public void validateEmptyValue() throws Exception { ValidatorsTestSuite.assertValidationResultOK(validator, validator.validate("")); }
@Test public void validateNullValue() throws Exception { ValidatorsTestSuite.assertValidationResultOK(validator, validator.validate(null)); }