Package yalp.data.validation.Validation

Examples of yalp.data.validation.Validation.ValidationResult


    }
    @Test
    public void testSingleColumn() {
        Book firstBook = Book.find("byIsbn", "1").first();
        firstBook.isbn = "2";
        ValidationResult res = Validation.current().valid(firstBook);
        assertFalse(res.ok);
        assertNotNull(Validation.errors(".isbn"));
        Error error = Validation.errors(".isbn").get(0);
        assertEquals("Must be unique", error.message());
    }
View Full Code Here


    @Test
    public void testMultiColumn() {
        Author bob = Author.find("byName", "Bob").first();
        Book firstBook = Book.find("byIsbn", "1").first();
        firstBook.author = bob;
        ValidationResult res = Validation.current().valid(firstBook);
        assertFalse(res.ok);
        assertNotNull(Validation.errors(".title"));
        Error error = Validation.errors(".title").get(0);
        assertEquals("Must be unique", error.message());
View Full Code Here

    public void testOptimisticLockingCheck() {
        final TestModel testModel = new TestModel();
       
        Validation.clear();
       
        ValidationResult result = Validation.current().valid(testModel);
        assertTrue(result.ok);
       
        //You must disable setMessage in the check for this test:-/
        testModel.setVersion(Long.valueOf(2));       
        result = Validation.current().valid(testModel);
View Full Code Here

TOP

Related Classes of yalp.data.validation.Validation.ValidationResult

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.