Examples of validateValue()


Examples of javax.validation.Validator.validateValue()

     * <code>null</code> class.
     */
    public void testValidateValueOnNullClass() {
        Validator validator = getValidator();
        try {
            validator.validateValue(null, "class", Object.class);
            Assert.fail("No exception thrown when passing null as group array");
        } catch (IllegalArgumentException e) {
            // Correct
        }
    }
View Full Code Here

Examples of javax.validation.Validator.validateValue()

    public void testValidateValueInvalidPropertyName() {
        Validator validator = getValidator();

        // Null propertyName
        try {
            validator.validateValue(Person.class, null, "John");
        } catch (IllegalArgumentException e) {
            // Correct
        }

        // Empty propertyName
View Full Code Here

Examples of javax.validation.Validator.validateValue()

            // Correct
        }

        // Empty propertyName
        try {
            validator.validateValue(Person.class, "", "John");
        } catch (IllegalArgumentException e) {
            // Correct
        }

        // Invalid propertyName
View Full Code Here

Examples of javax.validation.Validator.validateValue()

            // Correct
        }

        // Invalid propertyName
        try {
            validator.validateValue(Person.class, "unexistant", "John");
        } catch (IllegalArgumentException e) {
            // Correct
        }
    }
View Full Code Here

Examples of javax.validation.Validator.validateValue()

     */
    public void testValidateValueNullGroup() {
        Validator validator = getValidator();
        try {
            Class<?>[] groups = null;
            validator.validateValue(Person.class, "name", "John", groups);
            Assert.fail("No exception thrown when passing null as group array");
        } catch (IllegalArgumentException e) {
            // Correct
        }
    }
View Full Code Here

Examples of javax.validation.Validator.validateValue()

    }

    public void testValidateValue() {
        Validator validator = getValidator();
        assertTrue(
              validator.validateValue(Book.class, "subtitle", "123456789098765432").isEmpty());
        assertFalse(validator.validateValue(Book.class, "subtitle",
              "123456789098765432123412345678909876543212341234564567890987654321234",
              Second.class).isEmpty());
        // tests for issue 22: validation of a field without any constraints
        assertEquals(0, validator.validateValue(Book.class, "unconstraintField", 4).size());
View Full Code Here

Examples of javax.validation.Validator.validateValue()

    public void testValidateValue() {
        Validator validator = getValidator();
        assertTrue(
              validator.validateValue(Book.class, "subtitle", "123456789098765432").isEmpty());
        assertFalse(validator.validateValue(Book.class, "subtitle",
              "123456789098765432123412345678909876543212341234564567890987654321234",
              Second.class).isEmpty());
        // tests for issue 22: validation of a field without any constraints
        assertEquals(0, validator.validateValue(Book.class, "unconstraintField", 4).size());
        // tests for issue 22: validation of unknown field cause ValidationException
View Full Code Here

Examples of javax.validation.Validator.validateValue()

              validator.validateValue(Book.class, "subtitle", "123456789098765432").isEmpty());
        assertFalse(validator.validateValue(Book.class, "subtitle",
              "123456789098765432123412345678909876543212341234564567890987654321234",
              Second.class).isEmpty());
        // tests for issue 22: validation of a field without any constraints
        assertEquals(0, validator.validateValue(Book.class, "unconstraintField", 4).size());
        // tests for issue 22: validation of unknown field cause ValidationException
        try {
            validator.validateValue(Book.class, "unknownProperty", 4);
            fail("unknownProperty not detected");
        } catch (IllegalArgumentException ex) {
View Full Code Here

Examples of javax.validation.Validator.validateValue()

              Second.class).isEmpty());
        // tests for issue 22: validation of a field without any constraints
        assertEquals(0, validator.validateValue(Book.class, "unconstraintField", 4).size());
        // tests for issue 22: validation of unknown field cause ValidationException
        try {
            validator.validateValue(Book.class, "unknownProperty", 4);
            fail("unknownProperty not detected");
        } catch (IllegalArgumentException ex) {
            // OK
            assertEquals(
                  "unknown property 'unknownProperty' in org.apache.bval.jsr303.example.Book",
View Full Code Here

Examples of javax.validation.Validator.validateValue()

    }

    @Test
    public void testValidator() throws Exception {
        Validator validator = createValidator();
        Set<?> constrains = validator.validateValue(getBeanType(), (String) getOptions().get(PROP), criteria.getValue());
        try {
            validateOnClient(validator);
            assertTrue("Bean validator found error for value: " + criteria.getValue() + ", validator options: " + getOptions(),
                constrains.isEmpty());
        } catch (ScriptException e2) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.