Examples of ValidationErrorException


Examples of net.mindengine.galen.validation.ValidationErrorException

       
        for (String childObjectName : childObjects) {
            PageElement childObject = pageValidation.findPageElement(childObjectName);
            if (childObject != null) {
                if (!childObject.isPresent()) {
                    throw new ValidationErrorException()
                        .withMessage(format(OBJECT_S_IS_ABSENT_ON_PAGE, childObjectName));
                }
                else if (!childObject.isVisible()) {
                    throw new ValidationErrorException()
                        .withMessage(format(OBJECT_S_IS_NOT_VISIBLE_ON_PAGE, childObjectName));
                }
                else {
                    Rect childObjectArea = childObject.getArea();
                    if (!childObjectMatches(spec, objectArea, childObjectArea)) {
                        errorAreas.add(new ErrorArea(childObjectArea, childObjectName));
                        errorMessages.add(format("\"%s\" is outside \"%s\"", childObjectName, objectName));
                    }
                }
            }
            else {
                throw new ValidationErrorException()
                    .withMessage(format(OBJECT_WITH_NAME_S_IS_NOT_DEFINED_IN_PAGE_SPEC, childObjectName));
            }
        }
       
        if (errorMessages.size() > 0 ) {
            throw new ValidationErrorException(errorAreas, errorMessages).withErrorArea(new ErrorArea(objectArea, objectName));
        }
    }
View Full Code Here

Examples of net.mindengine.galen.validation.ValidationErrorException

    @Override
    public void check(PageValidation pageValidation, String objectName, SpecAbsent spec) throws ValidationErrorException {
        PageElement mainObject = pageValidation.findPageElement(objectName);
        if (mainObject == null) {
            throw new ValidationErrorException(String.format(OBJECT_WITH_NAME_S_IS_NOT_DEFINED_IN_PAGE_SPEC, objectName));
        }
        else if (mainObject.isPresent() && mainObject.isVisible()) {
            throw new ValidationErrorException()
                .withErrorArea(new ErrorArea(mainObject.getArea(), objectName))
                .withMessage(format("\"%s\" is not absent on page", objectName));
        }
    }
View Full Code Here

Examples of net.mindengine.galen.validation.ValidationErrorException

                messages.add(message);
            }
        }
       
        if (messages.size() > 0) {
          throw new ValidationErrorException()
                .withErrorArea(new ErrorArea(mainArea, objectName))
                .withErrorArea(new ErrorArea(secondArea, spec.getObject()))
                .withMessage(createMessage(messages, objectName));
        }
    }
View Full Code Here

Examples of net.mindengine.galen.validation.ValidationErrorException

        PageElement childObject = pageValidation.findPageElement(spec.getObject());
        checkAvailability(childObject, spec.getObject());
       
        int offset = Math.abs(getOffset(spec, mainObject, childObject));
        if (offset > Math.abs(spec.getErrorRate())) {
            throw new ValidationErrorException(Arrays.asList(new ErrorArea(mainObject.getArea(), objectName), new ErrorArea(childObject.getArea(), spec.getObject())),
                    Arrays.asList(errorMisalignedObjects(objectName, spec.getObject(), spec, offset)));
        }
    }
View Full Code Here

Examples of net.mindengine.galen.validation.ValidationErrorException

                new PageValidation(pageValidation.getBrowser(), objectContextPage, componentPageSpec, validationListener, pageValidation.getSectionFilter()),
                validationListener);
       
        List<ValidationError> errors = sectionValidation.check();
        if (errors != null && errors.size() > 0) {
            throw new ValidationErrorException("Child component spec contains " + errors.size() + " errors");
        }
    }
View Full Code Here

Examples of net.mindengine.galen.validation.ValidationErrorException

    }

    private void checkCentered(int offsetA, int offsetB, String objectName, SpecCentered spec, String location, String alignment) throws ValidationErrorException {
        int offset = Math.abs(offsetA - offsetB);
        if (offset > spec.getErrorRate()) {
            throw new ValidationErrorException(String.format("\"%s\" is not centered %s %s \"%s\". Offset is %dpx", objectName, alignment, location, spec.getObject(), offset));
        }
       
        if (offsetA < 0 || offsetB < 0){
            throw new ValidationErrorException(String.format("\"%s\" is centered but not %s %s \"%s\"", objectName, alignment, location, spec.getObject(), offset));
        }
    }
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.