Search in sources :

Example 16 with StringToIntegerConverter

use of com.vaadin.flow.data.converter.StringToIntegerConverter in project flow by vaadin.

the class BeanBinderTest method bindInstanceFields_does_not_automatically_bind_incomplete_forField_bindings.

@Test(expected = IllegalStateException.class)
public void bindInstanceFields_does_not_automatically_bind_incomplete_forField_bindings() {
    Binder<TestBean> otherBinder = new Binder<>(TestBean.class);
    TestClass testClass = new TestClass();
    otherBinder.forField(testClass.number).withConverter(new StringToIntegerConverter(""));
    // Should throw an IllegalStateException since the binding for number is
    // not completed with bind
    otherBinder.bindInstanceFields(testClass);
}
Also used : StringToIntegerConverter(com.vaadin.flow.data.converter.StringToIntegerConverter) Test(org.junit.Test)

Aggregations

StringToIntegerConverter (com.vaadin.flow.data.converter.StringToIntegerConverter)16 Test (org.junit.Test)16 Person (com.vaadin.flow.tests.data.bean.Person)14 Matchers.isEmptyString (org.hamcrest.Matchers.isEmptyString)10 TestTextField (com.vaadin.flow.data.binder.testcomponents.TestTextField)9 Matchers.containsString (org.hamcrest.Matchers.containsString)9 BindingBuilder (com.vaadin.flow.data.binder.Binder.BindingBuilder)7 StringLengthValidator (com.vaadin.flow.data.validator.StringLengthValidator)7 HasValue (com.vaadin.flow.component.HasValue)6 UI (com.vaadin.flow.component.UI)6 Binding (com.vaadin.flow.data.binder.Binder.Binding)6 IntegerRangeValidator (com.vaadin.flow.data.validator.IntegerRangeValidator)6 NotEmptyValidator (com.vaadin.flow.data.validator.NotEmptyValidator)6 CurrentInstance (com.vaadin.flow.internal.CurrentInstance)6 Serializable (java.io.Serializable)6 HashMap (java.util.HashMap)6 Locale (java.util.Locale)6 Map (java.util.Map)6 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)6 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)6