use of com.vaadin.flow.data.binder.testcomponents.TestTextField in project flow by vaadin.
the class BeanBinderTest method subfield_name_fieldIsRequired.
@Test
public void subfield_name_fieldIsRequired() {
BeanValidationBinder<RequiredConstraints> binder = new BeanValidationBinder<>(RequiredConstraints.class);
RequiredConstraints bean = new RequiredConstraints();
bean.setSubfield(new RequiredConstraints.SubConstraint());
TestTextField field = new TestTextField();
binder.bind(field, "subfield.name");
binder.setBean(bean);
Assert.assertTrue(field.isRequiredIndicatorVisible());
testSerialization(binder);
}
use of com.vaadin.flow.data.binder.testcomponents.TestTextField 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.testcomponents.TestTextField in project flow by vaadin.
the class BeanBinderTest method subfield_name_valueCanBeValidated.
@Test
public void subfield_name_valueCanBeValidated() {
BeanValidationBinder<RequiredConstraints> binder = new BeanValidationBinder<>(RequiredConstraints.class);
TestTextField field = new TestTextField();
binder.bind(field, "subfield.name");
RequiredConstraints bean = new RequiredConstraints();
bean.setSubfield(new SubConstraint());
binder.setBean(bean);
Assert.assertFalse(binder.validate().isOk());
field.setValue("overfive");
Assert.assertTrue(binder.validate().isOk());
}
use of com.vaadin.flow.data.binder.testcomponents.TestTextField in project flow by vaadin.
the class BeanBinderTest method firstName_isNotNullConstraint_fieldIsRequired.
@Test
public void firstName_isNotNullConstraint_fieldIsRequired() {
BeanValidationBinder<RequiredConstraints> binder = new BeanValidationBinder<>(RequiredConstraints.class);
RequiredConstraints bean = new RequiredConstraints();
TestTextField field = new TestTextField();
binder.bind(field, "firstname");
binder.setBean(bean);
Assert.assertTrue(field.isRequiredIndicatorVisible());
testSerialization(binder);
}
use of com.vaadin.flow.data.binder.testcomponents.TestTextField in project flow by vaadin.
the class BeanBinderTest method age_minSizeConstraint_fieldIsRequired.
@Test
public void age_minSizeConstraint_fieldIsRequired() {
BeanValidationBinder<RequiredConstraints> binder = new BeanValidationBinder<>(RequiredConstraints.class);
RequiredConstraints bean = new RequiredConstraints();
TestTextField field = new TestTextField();
binder.bind(field, "age");
binder.setBean(bean);
Assert.assertTrue(field.isRequiredIndicatorVisible());
testSerialization(binder);
}
Aggregations