use of org.springframework.validation.beanvalidation.LocalValidatorFactoryBean in project spring-framework by spring-projects.
the class ModelAttributeMethodArgumentResolverTests method setup.
@Before
public void setup() throws Exception {
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
validator.afterPropertiesSet();
ConfigurableWebBindingInitializer initializer = new ConfigurableWebBindingInitializer();
initializer.setValidator(validator);
this.bindContext = new BindingContext(initializer);
}
use of org.springframework.validation.beanvalidation.LocalValidatorFactoryBean in project spring-petclinic by spring-projects.
the class ValidatorTests method createValidator.
private Validator createValidator() {
LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean();
localValidatorFactoryBean.afterPropertiesSet();
return localValidatorFactoryBean;
}
use of org.springframework.validation.beanvalidation.LocalValidatorFactoryBean in project spring-boot by spring-projects.
the class SpringValidatorTests method wrapperInvokesCallbackOnNonManagedBean.
@Test
public void wrapperInvokesCallbackOnNonManagedBean() {
load(NonManagedBeanConfig.class);
LocalValidatorFactoryBean validator = this.context.getBean(NonManagedBeanConfig.class).validator;
verify(validator, times(1)).setApplicationContext(any(ApplicationContext.class));
verify(validator, times(1)).afterPropertiesSet();
verify(validator, times(0)).destroy();
this.context.close();
this.context = null;
verify(validator, times(1)).destroy();
}
use of org.springframework.validation.beanvalidation.LocalValidatorFactoryBean in project spring-boot by spring-projects.
the class SpringValidatorTests method wrapperDoesNotInvokeCallbackOnManagedBean.
@Test
public void wrapperDoesNotInvokeCallbackOnManagedBean() {
load(ManagedBeanConfig.class);
LocalValidatorFactoryBean validator = this.context.getBean(ManagedBeanConfig.class).validator;
verify(validator, times(0)).setApplicationContext(any(ApplicationContext.class));
verify(validator, times(0)).afterPropertiesSet();
verify(validator, times(0)).destroy();
this.context.close();
this.context = null;
verify(validator, times(0)).destroy();
}
use of org.springframework.validation.beanvalidation.LocalValidatorFactoryBean in project spring-boot by spring-projects.
the class RelaxedDataBinderTests method getBinder.
private RelaxedDataBinder getBinder(Object target, String namePrefix) {
RelaxedDataBinder binder = new RelaxedDataBinder(target, namePrefix);
binder.setIgnoreUnknownFields(false);
LocalValidatorFactoryBean validatorFactoryBean = new LocalValidatorFactoryBean();
validatorFactoryBean.afterPropertiesSet();
binder.setValidator(validatorFactoryBean);
binder.setConversionService(this.conversionService);
return binder;
}
Aggregations