Search in sources :

Example 81 with ValidatorFactory

use of javax.validation.ValidatorFactory in project tomee by apache.

the class AppComposerAsJUnitRuleTest method injectionValidatorFactory.

@Test
public void injectionValidatorFactory() {
    final ValidatorFactory validatorFactory = persistManager.getValidatorFactory();
    assertNotNull(validatorFactory);
}
Also used : ValidatorFactory(javax.validation.ValidatorFactory) Test(org.junit.Test)

Example 82 with ValidatorFactory

use of javax.validation.ValidatorFactory in project tomee by apache.

the class AppComposerAsJUnitRuleWithReusableModulesTest method injectionValidatorFactory.

@Test
public void injectionValidatorFactory() {
    final ValidatorFactory validatorFactory = persistManager.getValidatorFactory();
    assertNotNull(validatorFactory);
}
Also used : ValidatorFactory(javax.validation.ValidatorFactory) Test(org.junit.Test)

Example 83 with ValidatorFactory

use of javax.validation.ValidatorFactory in project tomee by apache.

the class BeanValidationTest method lookupValidatorFactory.

@Test
public void lookupValidatorFactory() throws Exception {
    final ValidatorFactory validatorFactory = (ValidatorFactory) new InitialContext().lookup("java:comp/ValidatorFactory");
    assertNotNull(validatorFactory);
}
Also used : ValidatorFactory(javax.validation.ValidatorFactory) InitialContext(javax.naming.InitialContext) Test(org.junit.Test)

Example 84 with ValidatorFactory

use of javax.validation.ValidatorFactory in project minijax by minijax.

the class ValidationTest method setUpValidator.

@BeforeClass
public static void setUpValidator() {
    // tag::setUpValidator[]
    ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
    validator = factory.getValidator();
// end::setUpValidator[]
}
Also used : ValidatorFactory(javax.validation.ValidatorFactory) BeforeClass(org.junit.BeforeClass)

Example 85 with ValidatorFactory

use of javax.validation.ValidatorFactory in project minijax by minijax.

the class CarTest method setUpValidator.

@BeforeClass
public static void setUpValidator() {
    ValidatorFactory factory = Validation.byProvider(MinijaxValidationProvider.class).configure().buildValidatorFactory();
    validator = factory.getValidator();
}
Also used : ValidatorFactory(javax.validation.ValidatorFactory) BeforeClass(org.junit.BeforeClass)

Aggregations

ValidatorFactory (javax.validation.ValidatorFactory)106 Validator (javax.validation.Validator)31 Before (org.junit.Before)28 ConstraintViolation (javax.validation.ConstraintViolation)25 Test (org.junit.Test)17 BeforeClass (org.junit.BeforeClass)13 ConstraintViolationException (javax.validation.ConstraintViolationException)7 HibernateValidatorConfiguration (org.hibernate.validator.HibernateValidatorConfiguration)6 ResourceBundleMessageInterpolator (org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator)6 PlatformResourceBundleLocator (org.hibernate.validator.resourceloading.PlatformResourceBundleLocator)6 ArrayList (java.util.ArrayList)5 HashMap (java.util.HashMap)5 BeanManager (javax.enterprise.inject.spi.BeanManager)5 InitialContext (javax.naming.InitialContext)5 ResourceBundleMessageSource (org.springframework.context.support.ResourceBundleMessageSource)5 HashSet (java.util.HashSet)4 NamingException (javax.naming.NamingException)4 ConstraintValidatorFactory (javax.validation.ConstraintValidatorFactory)4 ValidatorContext (javax.validation.ValidatorContext)4 HibernateValidator (org.hibernate.validator.HibernateValidator)4