Ejemplo n.º 1
0
        public virtual void testMaxLengthValidator()
        {
            MaxLengthValidator validator = new MaxLengthValidator();

            assertTrue(validator.validate(null, null));

            assertTrue(validator.validate("test", new TestValidatorContext("5")));
            assertFalse(validator.validate("test", new TestValidatorContext("4")));

            try
            {
                validator.validate("test", new TestValidatorContext("4.4"));
                fail("exception expected");
            }
            catch (FormException e)
            {
                assertTrue(e.Message.contains("Cannot validate \"maxlength\": configuration 4.4 cannot be interpreted as Integer"));
            }
        }