Package com.vaadin.tests.data.bean

Examples of com.vaadin.tests.data.bean.BeanToValidate


    public void testBeanValidationNotAddedTwice() {
        // See ticket #11045
        BeanFieldGroup<BeanToValidate> fieldGroup = new BeanFieldGroup<BeanToValidate>(
                BeanToValidate.class);

        BeanToValidate beanToValidate = new BeanToValidate();
        beanToValidate.setFirstname("a");
        fieldGroup.setItemDataSource(beanToValidate);

        Field<?> nameField = fieldGroup.buildAndBind("firstname");
        Assert.assertEquals(1, nameField.getValidators().size());

        try {
            nameField.validate();
        } catch (InvalidValueException e) {
            // NOTE: causes are empty if only one validation fails
            Assert.assertEquals(0, e.getCauses().length);
        }

        // Create new, identical bean to cause duplicate validator unless #11045
        // is fixed
        beanToValidate = new BeanToValidate();
        beanToValidate.setFirstname("a");
        fieldGroup.setItemDataSource(beanToValidate);

        Assert.assertEquals(1, nameField.getValidators().size());

        try {
View Full Code Here

TOP

Related Classes of com.vaadin.tests.data.bean.BeanToValidate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.