Search in sources :

Example 1 with MyCustomStringImpl

use of org.hibernate.validator.testutil.MyCustomStringImpl in project hibernate-validator by hibernate.

the class EmailValidatorTest method testValidEmailCharSequence.

@Test
@TestForIssue(jiraKey = "HV-502")
public void testValidEmailCharSequence() throws Exception {
    isValidEmail(new MyCustomStringImpl("emmanuel@hibernate.org"));
    isInvalidEmail(new MyCustomStringImpl("@example.com"));
}
Also used : MyCustomStringImpl(org.hibernate.validator.testutil.MyCustomStringImpl) Test(org.testng.annotations.Test) TestForIssue(org.hibernate.validator.testutil.TestForIssue)

Example 2 with MyCustomStringImpl

use of org.hibernate.validator.testutil.MyCustomStringImpl in project hibernate-validator by hibernate.

the class LuhnCheckValidatorTest method testFailOnNonNumeric.

@Test
public void testFailOnNonNumeric() throws Exception {
    LuhnCheckValidator validator = new LuhnCheckValidator();
    LuhnCheck modCheck = createLuhnCheckAnnotation(0, Integer.MAX_VALUE, -1, false);
    validator.initialize(modCheck);
    assertFalse(validator.isValid(new MyCustomStringImpl("A79927398713"), null));
}
Also used : LuhnCheck(org.hibernate.validator.constraints.LuhnCheck) LuhnCheckValidator(org.hibernate.validator.internal.constraintvalidators.hv.LuhnCheckValidator) MyCustomStringImpl(org.hibernate.validator.testutil.MyCustomStringImpl) Test(org.testng.annotations.Test)

Example 3 with MyCustomStringImpl

use of org.hibernate.validator.testutil.MyCustomStringImpl in project hibernate-validator by hibernate.

the class LuhnCheckValidatorTest method testIgnoreNonNumeric.

@Test
public void testIgnoreNonNumeric() throws Exception {
    LuhnCheckValidator validator = new LuhnCheckValidator();
    LuhnCheck modCheck = createLuhnCheckAnnotation(0, Integer.MAX_VALUE, -1, true);
    validator.initialize(modCheck);
    assertTrue(validator.isValid(new MyCustomStringImpl("A79927398713"), null));
}
Also used : LuhnCheck(org.hibernate.validator.constraints.LuhnCheck) LuhnCheckValidator(org.hibernate.validator.internal.constraintvalidators.hv.LuhnCheckValidator) MyCustomStringImpl(org.hibernate.validator.testutil.MyCustomStringImpl) Test(org.testng.annotations.Test)

Example 4 with MyCustomStringImpl

use of org.hibernate.validator.testutil.MyCustomStringImpl in project hibernate-validator by hibernate.

the class Mod10CheckValidatorTest method testInvalidMod10.

@Test
public void testInvalidMod10() throws Exception {
    Mod10CheckValidator validator = new Mod10CheckValidator();
    Mod10Check modCheck = createMod10CheckAnnotation(0, Integer.MAX_VALUE, -1, false);
    validator.initialize(modCheck);
    assertFalse(validator.isValid(new MyCustomStringImpl("79927398713"), null));
}
Also used : Mod10Check(org.hibernate.validator.constraints.Mod10Check) Mod10CheckValidator(org.hibernate.validator.internal.constraintvalidators.hv.Mod10CheckValidator) MyCustomStringImpl(org.hibernate.validator.testutil.MyCustomStringImpl) Test(org.testng.annotations.Test)

Example 5 with MyCustomStringImpl

use of org.hibernate.validator.testutil.MyCustomStringImpl in project hibernate-validator by hibernate.

the class Mod10CheckValidatorTest method testValidIdentcode.

@Test
@TestForIssue(jiraKey = "HV-813")
public void testValidIdentcode() throws Exception {
    Mod10CheckValidator validator = new Mod10CheckValidator();
    Mod10Check modCheck = createMod10CheckAnnotation(0, Integer.MAX_VALUE, -1, true, 4, 9);
    validator.initialize(modCheck);
    assertTrue(validator.isValid(new MyCustomStringImpl("56.310 243.031 3"), null));
}
Also used : Mod10Check(org.hibernate.validator.constraints.Mod10Check) Mod10CheckValidator(org.hibernate.validator.internal.constraintvalidators.hv.Mod10CheckValidator) MyCustomStringImpl(org.hibernate.validator.testutil.MyCustomStringImpl) Test(org.testng.annotations.Test) TestForIssue(org.hibernate.validator.testutil.TestForIssue)

Aggregations

MyCustomStringImpl (org.hibernate.validator.testutil.MyCustomStringImpl)23 Test (org.testng.annotations.Test)23 TestForIssue (org.hibernate.validator.testutil.TestForIssue)10 Mod10Check (org.hibernate.validator.constraints.Mod10Check)8 Mod10CheckValidator (org.hibernate.validator.internal.constraintvalidators.hv.Mod10CheckValidator)8 LuhnCheck (org.hibernate.validator.constraints.LuhnCheck)3 ModCheck (org.hibernate.validator.constraints.ModCheck)3 LuhnCheckValidator (org.hibernate.validator.internal.constraintvalidators.hv.LuhnCheckValidator)3 ModCheckValidator (org.hibernate.validator.internal.constraintvalidators.hv.ModCheckValidator)3 ConstraintViolation (jakarta.validation.ConstraintViolation)2 Mod11Check (org.hibernate.validator.constraints.Mod11Check)2 Mod11CheckValidator (org.hibernate.validator.internal.constraintvalidators.hv.Mod11CheckValidator)2 ConstraintAnnotationDescriptor (org.hibernate.validator.internal.util.annotation.ConstraintAnnotationDescriptor)2 Pattern (jakarta.validation.constraints.Pattern)1 CodePointLength (org.hibernate.validator.constraints.CodePointLength)1 CreditCardNumber (org.hibernate.validator.constraints.CreditCardNumber)1 Length (org.hibernate.validator.constraints.Length)1 Normalized (org.hibernate.validator.constraints.Normalized)1 PatternValidator (org.hibernate.validator.internal.constraintvalidators.bv.PatternValidator)1 CodePointLengthValidator (org.hibernate.validator.internal.constraintvalidators.hv.CodePointLengthValidator)1