Package play.data.validation

Examples of play.data.validation.Error.message()


        firstBook.isbn = "2";
        ValidationResult res = Validation.current().valid(firstBook);
        assertFalse(res.ok);
        assertNotNull(Validation.errors(".isbn"));
        Error error = Validation.errors(".isbn").get(0);
        assertEquals("validation.unique", error.message());
    }

    @Test
    public void testMultiColumn() {
        Author bob = Author.find("byName", "Bob").first();
View Full Code Here


        firstBook.author = bob;
        ValidationResult res = Validation.current().valid(firstBook);
        assertFalse(res.ok);
        assertNotNull(Validation.errors(".title"));
        Error error = Validation.errors(".title").get(0);
        assertEquals("validation.unique", error.message());

        Validation.clear();
        firstBook.title = "Bobs Book";
        res = Validation.current().valid(firstBook);
        assertTrue(res.ok);
View Full Code Here

        assertNotNull(Validation.errors(".version"));
        Error error = Validation.errors(".version").get(0);
        System.out.println(error.getKey());
        assertEquals("The object was changed. Your version is 1 the database version is 2. " +
                "<a href=\"/@tests/models.OptimisticLockingModelPlayTest.class\">Reload</a> " +
                "and do your changes again.", error.message());      
    }
   
   
    @Entity
    public static class TestModel extends OptimisticLockingModel {
View Full Code Here

        }
        String key = args.get("arg") == null ? args.get("key") + "" : args.get("arg") + "";
        Error error = Validation.error(key);
        if (error != null) {
            if (args.get("field") == null) {
                out.print(error.message());
            } else {
                out.print(error.message(args.get("field") + ""));
            }
        }
    }
View Full Code Here

        Error error = Validation.error(key);
        if (error != null) {
            if (args.get("field") == null) {
                out.print(error.message());
            } else {
                out.print(error.message(args.get("field") + ""));
            }
        }
    }

    static boolean _evaluateCondition(Object test) {
View Full Code Here

        }
        String key = args.get("arg") == null ? args.get("key") + "" : args.get("arg") + "";
        Error error = Validation.error(key);
        if (error != null) {
            if (args.get("field") == null) {
                out.print(error.message());
            } else {
                out.print(error.message(args.get("field") + ""));
            }
        }
    }
View Full Code Here

        Error error = Validation.error(key);
        if (error != null) {
            if (args.get("field") == null) {
                out.print(error.message());
            } else {
                out.print(error.message(args.get("field") + ""));
            }
        }
    }

    static boolean _evaluateCondition(Object test) {
View Full Code Here

        }
        String key = args.get("arg") == null ? args.get("key") + "" : args.get("arg") + "";
        Error error = Validation.error(key);
        if (error != null) {
            if (args.get("field") == null) {
                out.print(error.message());
            } else {
                out.print(error.message(args.get("field") + ""));
            }
        }
    }
View Full Code Here

        Error error = Validation.error(key);
        if (error != null) {
            if (args.get("field") == null) {
                out.print(error.message());
            } else {
                out.print(error.message(args.get("field") + ""));
            }
        }
    }

    static boolean _evaluateCondition(Object test) {
View Full Code Here

        result = Validation.current().valid(testModel);
        assertFalse(result.ok);
        assertNotNull(Validation.errors("testModel.version"));
        Error error = Validation.errors("testModel.version").get(0);
        assertEquals("The object was changed. Your version is 1 the database version is 2. " +
                "Reload and do your changes again.", error.message());      
    }
   
   
    @Entity
    public static class TestModel extends OptimisticLockingModel {
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.