Java Code Examples for org.springframework.validation.Errors#getFieldValue()

The following examples show how to use org.springframework.validation.Errors#getFieldValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ValidatorFactoryTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void testInnerBeanValidation() {
	LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
	validator.afterPropertiesSet();

	MainBean mainBean = new MainBean();
	Errors errors = new BeanPropertyBindingResult(mainBean, "mainBean");
	validator.validate(mainBean, errors);
	Object rejected = errors.getFieldValue("inner.value");
	assertNull(rejected);
}
 
Example 2
Source File: ValidatorFactoryTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void testValidationWithOptionalField() {
	LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
	validator.afterPropertiesSet();

	MainBeanWithOptional mainBean = new MainBeanWithOptional();
	Errors errors = new BeanPropertyBindingResult(mainBean, "mainBean");
	validator.validate(mainBean, errors);
	Object rejected = errors.getFieldValue("inner.value");
	assertNull(rejected);
}
 
Example 3
Source File: ValidatorFactoryTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void testInnerBeanValidation() {
	LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
	validator.afterPropertiesSet();

	MainBean mainBean = new MainBean();
	Errors errors = new BeanPropertyBindingResult(mainBean, "mainBean");
	validator.validate(mainBean, errors);
	Object rejected = errors.getFieldValue("inner.value");
	assertNull(rejected);
}
 
Example 4
Source File: ValidatorFactoryTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void testValidationWithOptionalField() {
	LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
	validator.afterPropertiesSet();

	MainBeanWithOptional mainBean = new MainBeanWithOptional();
	Errors errors = new BeanPropertyBindingResult(mainBean, "mainBean");
	validator.validate(mainBean, errors);
	Object rejected = errors.getFieldValue("inner.value");
	assertNull(rejected);
}
 
Example 5
Source File: ValidatorFactoryTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testInnerBeanValidation() {
	LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
	validator.afterPropertiesSet();

	MainBean mainBean = new MainBean();
	Errors errors = new BeanPropertyBindingResult(mainBean, "mainBean");
	validator.validate(mainBean, errors);
	Object rejected = errors.getFieldValue("inner.value");
	assertNull(rejected);
}
 
Example 6
Source File: ValidatorFactoryTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testValidationWithOptionalField() {
	LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
	validator.afterPropertiesSet();

	MainBeanWithOptional mainBean = new MainBeanWithOptional();
	Errors errors = new BeanPropertyBindingResult(mainBean, "mainBean");
	validator.validate(mainBean, errors);
	Object rejected = errors.getFieldValue("inner.value");
	assertNull(rejected);
}
 
Example 7
Source File: ValidatorFactoryTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testInnerBeanValidation() {
	LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
	validator.afterPropertiesSet();

	MainBean mainBean = new MainBean();
	Errors errors = new BeanPropertyBindingResult(mainBean, "mainBean");
	validator.validate(mainBean, errors);
	Object rejected = errors.getFieldValue("inner.value");
	assertNull(rejected);
}
 
Example 8
Source File: ValidatorFactoryTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testValidationWithOptionalField() {
	LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
	validator.afterPropertiesSet();

	MainBeanWithOptional mainBean = new MainBeanWithOptional();
	Errors errors = new BeanPropertyBindingResult(mainBean, "mainBean");
	validator.validate(mainBean, errors);
	Object rejected = errors.getFieldValue("inner.value");
	assertNull(rejected);
}
 
Example 9
Source File: ValidatorFactoryTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testInnerBeanValidation() throws Exception {
	LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
	validator.afterPropertiesSet();

	MainBean mainBean = new MainBean();
	Errors errors = new BeanPropertyBindingResult(mainBean, "mainBean");
	validator.validate(mainBean, errors);
	Object rejected = errors.getFieldValue("inner.value");
	assertNull(rejected);
}
 
Example 10
Source File: ValidatorFactoryTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testValidationWithOptionalField() throws Exception {
	LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
	validator.afterPropertiesSet();

	MainBeanWithOptional mainBean = new MainBeanWithOptional();
	Errors errors = new BeanPropertyBindingResult(mainBean, "mainBean");
	validator.validate(mainBean, errors);
	Object rejected = errors.getFieldValue("inner.value");
	assertNull(rejected);
}
 
Example 11
Source File: ValidatorFactoryTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testInnerBeanValidation() throws Exception {
	LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
	validator.afterPropertiesSet();

	MainBean mainBean = new MainBean();
	Errors errors = new BeanPropertyBindingResult(mainBean, "mainBean");
	validator.validate(mainBean, errors);
	Object rejected = errors.getFieldValue("inner.value");
	assertNull(rejected);
}
 
Example 12
Source File: ValidatorFactoryTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testValidationWithOptionalField() throws Exception {
	LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
	validator.afterPropertiesSet();

	MainBeanWithOptional mainBean = new MainBeanWithOptional();
	Errors errors = new BeanPropertyBindingResult(mainBean, "mainBean");
	validator.validate(mainBean, errors);
	Object rejected = errors.getFieldValue("inner.value");
	assertNull(rejected);
}