use of com.vaadin.flow.data.binder.BeanBinderTest.RequiredConstraints.SubSubConstraint in project flow by vaadin.
the class BeanBinderTest method subSubfield_name_valueCanBeValidated.
@Test
public void subSubfield_name_valueCanBeValidated() {
BeanValidationBinder<RequiredConstraints> binder = new BeanValidationBinder<>(RequiredConstraints.class);
TestTextField field = new TestTextField();
binder.bind(field, "subfield.subsub.value");
RequiredConstraints bean = new RequiredConstraints();
SubConstraint subfield = new SubConstraint();
bean.setSubfield(subfield);
subfield.setSubsub(new SubSubConstraint());
binder.setBean(bean);
Assert.assertFalse(binder.validate().isOk());
field.setValue("overtencharacters");
Assert.assertTrue(binder.validate().isOk());
}
use of com.vaadin.flow.data.binder.BeanBinderTest.RequiredConstraints.SubSubConstraint in project flow by vaadin.
the class BeanBinderTest method subsubfield_name_fieldIsRequired.
@Test
public void subsubfield_name_fieldIsRequired() {
BeanValidationBinder<RequiredConstraints> binder = new BeanValidationBinder<>(RequiredConstraints.class);
RequiredConstraints bean = new RequiredConstraints();
RequiredConstraints.SubConstraint subfield = new RequiredConstraints.SubConstraint();
subfield.setSubsub(new SubSubConstraint());
bean.setSubfield(subfield);
TestTextField field = new TestTextField();
binder.bind(field, "subfield.subsub.value");
binder.setBean(bean);
Assert.assertTrue(field.isRequiredIndicatorVisible());
testSerialization(binder);
}
Aggregations