Package org.apache.myfaces.extensions.cdi.bv.test.impl.validation

Examples of org.apache.myfaces.extensions.cdi.bv.test.impl.validation.TestBean


    /**
     */
    @Test
    public void testConstraintValidatorInjection()
    {
        Set<ConstraintViolation<TestBean>> violations = this.validator.validate(new TestBean("Tester", "Tester"));

        assertEquals(1, violations.size());
    }
View Full Code Here


    {
        ConstraintValidator<DifferentName, TestBean> constraintValidator =
                this.constraintValidatorFactory.getInstance(DifferentNameValidator.class);

        constraintValidator.initialize(DefaultAnnotation.of(DifferentName.class));
        boolean result = constraintValidator.isValid(new TestBean("Tester", "Tester"),
                        new ConstraintValidatorContext()
                        {
                            public void disableDefaultConstraintViolation()
                            {
                                //
View Full Code Here

                String message = messageTemplate.substring(messageTemplate.lastIndexOf("$") + 1);

                return message.replace("{invalidValue}", invalidValue);
            }
        }).getValidator();
        Set<ConstraintViolation<TestBean>> violations = validator.validate(new TestBean("Tester", "Tester"));

        assertEquals(1, violations.size());

        assertEquals("The same name 'Tester' isn't allowed.", violations.iterator().next().getMessage());
    }
View Full Code Here

                String message = messageTemplate.substring(messageTemplate.lastIndexOf("$") + 1);

                return message.replace("{invalidValue}", invalidValue);
            }
        }).getValidator();
        Set<ConstraintViolation<TestBean>> violations = validator.validate(new TestBean("Tester", "Tester"));

        assertEquals(1, violations.size());

        assertEquals("The same name 'Tester' isn't allowed.", violations.iterator().next().getMessage());
    }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.extensions.cdi.bv.test.impl.validation.TestBean

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.