Package org.auraframework.util.validation

Examples of org.auraframework.util.validation.ValidationError


        CSSLintValidator validator = new CSSLintValidator();
        List<ValidationError> errors = validator.validate("input.css",
                ".mybox {\n\tborder: 1px solid black;\n\tpadding: 5px;\n\twidth: 100px;}", false);
        assertEquals(2, errors.size());
        ValidationError error = errors.get(0);
        assertEquals("input.css", error.getFilename());
        assertEquals(2, error.getLine());
        assertEquals(2, error.getStartColumn());
        assertEquals("csslint", error.getValidatingTool());
        assertEquals("Using width with border can sometimes make elements larger than you expect", error.getMessage());
        assertEquals("\tborder: 1px solid black;", error.getEvidence());
        assertEquals(Level.Warning, error.getLevel());
        assertEquals("box-model", error.getRule());

        // can rerun on the same validator
        errors = validator.validate("input2.css",
                ".mybox {\n\tborder: 2px solid black;\n\tpadding: 5px;\n\twidth: 100px;}", false);
        assertEquals(2, errors.size());
View Full Code Here


    public void testValidate() throws Exception {
        JavascriptValidator validator = new JavascriptValidator();
        List<JavascriptProcessingError> errors = validator.validate("input.js", "var index = 1;\nindex++\nindex += 4;",
                false, false);
        assertEquals(1, errors.size());
        ValidationError error = errors.get(0);
        assertEquals("input.js", error.getFilename());
        assertEquals(2, error.getLine());
        assertEquals(8, error.getStartColumn());
        assertEquals("jslint", error.getValidatingTool());
        assertEquals("Expected ';' and instead saw 'index'", error.getMessage());
        assertEquals("index++", error.getEvidence());
        assertEquals(Level.Error, error.getLevel());
        assertNull(error.getRule());

        // can rerun on the same validator
        errors = validator.validate("input2.js", "var i = 1\ni++\n;", false, false);
        assertEquals(1, errors.size());
        assertEquals("input2.js", errors.get(0).getFilename());
View Full Code Here

                    + "Helper",
                    source, disableRulesForAura);

            for (int i = 0; i < lintErrors.size(); i++) {
                Map<String, ?> error = lintErrors.get(i);
                errors.add(new ValidationError(tool, filename, error));
            }
        } catch (Exception e) {
            // TODO: should be reported as a validation error
            throw new RuntimeException(e);
        }
View Full Code Here

        DefDescriptor<?> descriptor = DefDescriptorImpl.getInstance("js://validationTest.basic", ControllerDef.class);
        List<ValidationError> errors = new ValidationEngine().validate(descriptor);
        assertEquals(2, errors.size());

        // custom: missing (
        ValidationError error = errors.get(0);
        String filename = error.getFilename();
        assertEquals("js/custom", error.getValidatingTool());
        assertEquals("Starting '(' missing", error.getMessage());
        assertTrue(filename, filename.endsWith("/validationTest/basic/basicController.js"));
        assertEquals(5, error.getLine());
        assertEquals(1, error.getStartColumn());

        // jslint: missing ;
        error = errors.get(1);
        filename = error.getFilename();
        assertEquals("jslint", error.getValidatingTool());
        assertEquals("Expected ';' and instead saw '}'", error.getMessage());
        assertTrue(filename, filename.endsWith("/validationTest/basic/basicController.js"));
        assertEquals(7, error.getLine());
        assertEquals(20, error.getStartColumn());
    }
View Full Code Here

        DefDescriptor<?> descriptor = DefDescriptorImpl.getInstance("css://validationTest.basic", StyleDef.class);
        List<ValidationError> errors = new ValidationEngine().validate(descriptor);
        assertEquals(2, errors.size());

        // reports StyleParser errors
        ValidationError parserError = errors.get(0);
        String filename = parserError.getFilename();
        assertEquals("CSS selector must begin with '.validationTestBasic' or '.THIS'", parserError.getMessage());
        assertTrue(filename, filename.endsWith("/validationTest/basic/basic.css"));
        assertEquals(1, parserError.getLine());
        assertEquals(1, parserError.getStartColumn());

        // reports csslint errors
        ValidationError csslintError = errors.get(1);
        filename = csslintError.getFilename();
        assertEquals("The box-sizing property isn't supported in IE6 and IE7", csslintError.getMessage());
        assertTrue(filename, filename.endsWith("/validationTest/basic/basic.css"));
        assertEquals(2, csslintError.getLine());
        assertEquals(5, csslintError.getStartColumn());
    }
View Full Code Here

TOP

Related Classes of org.auraframework.util.validation.ValidationError

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.