aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/test')
-rw-r--r--server/src/test/java/com/vaadin/data/BinderTest.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/server/src/test/java/com/vaadin/data/BinderTest.java b/server/src/test/java/com/vaadin/data/BinderTest.java
index 9f20f0b246..999142a440 100644
--- a/server/src/test/java/com/vaadin/data/BinderTest.java
+++ b/server/src/test/java/com/vaadin/data/BinderTest.java
@@ -1542,6 +1542,29 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
}
@Test
+ public void invalidUsage_modifyFieldsInsideValidator_binderDoesNotThrow() {
+ TextField field = new TextField();
+
+ AtomicBoolean validatorIsExecuted = new AtomicBoolean();
+ binder.forField(field).asRequired().withValidator((val, context) -> {
+ nameField.setValue("foo");
+ ageField.setValue("bar");
+ validatorIsExecuted.set(true);
+ return ValidationResult.ok();
+ }).bind(Person::getEmail, Person::setEmail);
+
+ binder.forField(nameField).bind(Person::getFirstName,
+ Person::setFirstName);
+ binder.forField(ageField).bind(Person::getLastName,
+ Person::setLastName);
+
+ binder.setBean(new Person());
+
+ field.setValue("baz");
+ // mostly self control, the main check is: not exception is thrown
+ assertTrue(validatorIsExecuted.get());
+ }
+
public void setBean_readOnlyBinding_propertyBinding_valueIsNotUpdated() {
Binder<ExampleBean> binder = new Binder<>(ExampleBean.class);