Search in sources :

Example 1 with LocalValidatorFactoryBean

use of cn.taketoday.validation.beanvalidation.LocalValidatorFactoryBean in project today-framework by TAKETODAY.

the class RequestResponseBodyMethodProcessorMockTests method initBindingContext.

public void initBindingContext() {
    BindingContext bindingContext = new BindingContext() {

        @Override
        public void initBinder(WebDataBinder dataBinder, RequestContext request) {
            LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
            validator.afterPropertiesSet();
            dataBinder.setValidator(validator);
        }
    };
    webRequest.setBindingContext(bindingContext);
}
Also used : LocalValidatorFactoryBean(cn.taketoday.validation.beanvalidation.LocalValidatorFactoryBean) WebDataBinder(cn.taketoday.web.bind.WebDataBinder) RequestContext(cn.taketoday.web.RequestContext) ServletRequestContext(cn.taketoday.web.servlet.ServletRequestContext) BindingContext(cn.taketoday.web.BindingContext)

Example 2 with LocalValidatorFactoryBean

use of cn.taketoday.validation.beanvalidation.LocalValidatorFactoryBean in project today-framework by TAKETODAY.

the class ValidationBindHandlerTests method setup.

@BeforeEach
void setup() {
    this.binder = new Binder(this.sources);
    this.validator = new LocalValidatorFactoryBean();
    this.validator.afterPropertiesSet();
    this.handler = new ValidationBindHandler(this.validator);
}
Also used : LocalValidatorFactoryBean(cn.taketoday.validation.beanvalidation.LocalValidatorFactoryBean) Binder(cn.taketoday.context.properties.bind.Binder) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with LocalValidatorFactoryBean

use of cn.taketoday.validation.beanvalidation.LocalValidatorFactoryBean in project today-infrastructure by TAKETODAY.

the class ValidationBindHandlerTests method setup.

@BeforeEach
void setup() {
    this.binder = new Binder(this.sources);
    this.validator = new LocalValidatorFactoryBean();
    this.validator.afterPropertiesSet();
    this.handler = new ValidationBindHandler(this.validator);
}
Also used : LocalValidatorFactoryBean(cn.taketoday.validation.beanvalidation.LocalValidatorFactoryBean) Binder(cn.taketoday.context.properties.bind.Binder) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

LocalValidatorFactoryBean (cn.taketoday.validation.beanvalidation.LocalValidatorFactoryBean)3 Binder (cn.taketoday.context.properties.bind.Binder)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 BindingContext (cn.taketoday.web.BindingContext)1 RequestContext (cn.taketoday.web.RequestContext)1 WebDataBinder (cn.taketoday.web.bind.WebDataBinder)1 ServletRequestContext (cn.taketoday.web.servlet.ServletRequestContext)1