Package org.springmodules.validation.util.condition.common

Examples of org.springmodules.validation.util.condition.common.AlwaysTrueCondition


        ruleControl1.expectAndReturn(rule1.getErrorCode(), "errorCode1");
        ruleControl1.expectAndReturn(rule1.getDefaultErrorMessage(), "message1");
        ruleControl1.expectAndReturn(rule1.getErrorArguments(object), args);

        ruleControl2.expectAndReturn(rule2.isApplicable(object), true);
        ruleControl2.expectAndReturn(rule2.getCondition(), new AlwaysTrueCondition());

        ValidationRule[] globalRules = new ValidationRule[] { rule1, rule2 };
        configurationControl.expectAndReturn(configuration.getGlobalRules(), globalRules);

        converterControl.expectAndReturn(converter.convertGlobalErrorCode("errorCode1", Object.class), "_errorCode1");
View Full Code Here


    public void testValidateAndShortCircuitRules_WhenOnlyTheSecondFails() throws Exception {
        Object object = new Object();

        ruleControl1.expectAndReturn(rule1.isApplicable(object), true);
        ruleControl1.expectAndReturn(rule1.getCondition(), new AlwaysTrueCondition());

        Object[] args = new Object[0];
        ruleControl2.expectAndReturn(rule2.isApplicable(object), true);
        ruleControl2.expectAndReturn(rule2.getCondition(), new AlwaysFalseCondition());
        ruleControl2.expectAndReturn(rule2.getErrorCode(), "errorCode2");
View Full Code Here

    public void testValidateAndShortCircuitRules_WhenNoneFail() throws Exception {
        Object object = new Object();

        ruleControl1.expectAndReturn(rule1.isApplicable(object), true);
        ruleControl1.expectAndReturn(rule1.getCondition(), new AlwaysTrueCondition());

        ruleControl2.expectAndReturn(rule2.isApplicable(object), true);
        ruleControl2.expectAndReturn(rule2.getCondition(), new AlwaysTrueCondition());

        ValidationRule[] rules = new ValidationRule[] { rule1, rule2 };

        replay();
        validator.validateAndShortCircuitRules(rules, "name", object, errors);
View Full Code Here

     */
    protected AbstractValidationRule(String defaultErrorCode, ErrorArgumentsResolver defaultErrorArgumentsResolver) {
        this.errorCode = defaultErrorCode;
        this.defaultErrorMessage = this.errorCode;
        this.errorArgumentsResolver = defaultErrorArgumentsResolver;
        this.applicabilityCondition = new AlwaysTrueCondition();
    }
View Full Code Here

     * Constructs a new CascadeValidation with a given property name. This cascading always applies.
     *
     * @param propertyName The name of the property to which the validation will be cascaded.
     */
    public CascadeValidation(String propertyName) {
        this(propertyName, new AlwaysTrueCondition());
    }
View Full Code Here

        }
        if (!StringUtils.hasText(argsString)) {
            argsString = "";
        }
        ErrorArgumentsResolver argsResolver = buildErrorArgumentsResolver(argsString);
        Condition applyIfCondition = new AlwaysTrueCondition();
        if (StringUtils.hasText(applyIfString)) {
            applyIfCondition = conditionExpressionParser.parse(applyIfString);
        }

        String[] contexts = null;
View Full Code Here

        ruleControl1.expectAndReturn(rule1.getErrorCode(), "errorCode1");
        ruleControl1.expectAndReturn(rule1.getDefaultErrorMessage(), "message1");
        ruleControl1.expectAndReturn(rule1.getErrorArguments(object), args);

        ruleControl2.expectAndReturn(rule2.isApplicable(object), true);
        ruleControl2.expectAndReturn(rule2.getCondition(), new AlwaysTrueCondition());

        ValidationRule[] globalRules = new ValidationRule[]{rule1, rule2};
        configurationControl.expectAndReturn(configuration.getGlobalRules(), globalRules);

        converterControl.expectAndReturn(converter.convertGlobalErrorCode("errorCode1", Object.class), "_errorCode1");
View Full Code Here

    public void testValidateAndShortCircuitRules_WhenOnlyTheSecondFails() throws Exception {
        Object object = new Object();

        ruleControl1.expectAndReturn(rule1.isApplicable(object), true);
        ruleControl1.expectAndReturn(rule1.getCondition(), new AlwaysTrueCondition());

        Object[] args = new Object[0];
        ruleControl2.expectAndReturn(rule2.isApplicable(object), true);
        ruleControl2.expectAndReturn(rule2.getCondition(), new AlwaysFalseCondition());
        ruleControl2.expectAndReturn(rule2.getErrorCode(), "errorCode2");
View Full Code Here

    public void testValidateAndShortCircuitRules_WhenNoneFail() throws Exception {
        Object object = new Object();

        ruleControl1.expectAndReturn(rule1.isApplicable(object), true);
        ruleControl1.expectAndReturn(rule1.getCondition(), new AlwaysTrueCondition());

        ruleControl2.expectAndReturn(rule2.isApplicable(object), true);
        ruleControl2.expectAndReturn(rule2.getCondition(), new AlwaysTrueCondition());

        ValidationRule[] rules = new ValidationRule[]{rule1, rule2};

        replay();
        validator.validateAndShortCircuitRules(rules, "name", object, errors);
View Full Code Here

     * Constructs a new CascadeValidation with a given property name. This cascading always applies.
     *
     * @param propertyName The name of the property to which the validation will be cascaded.
     */
    public CascadeValidation(String propertyName) {
        this(propertyName, new AlwaysTrueCondition());
    }
View Full Code Here

TOP

Related Classes of org.springmodules.validation.util.condition.common.AlwaysTrueCondition

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.