Package org.springmodules.validation.util.condition

Examples of org.springmodules.validation.util.condition.Condition.check()


        assertTrue(condition.check("test"));
    }

    public void testCheck_SuccessWithInheritance() throws Exception {
        Condition condition = new InstanceOfCondition(Collection.class);
        assertTrue(condition.check(new ArrayList()));
    }

    public void testCheck_Failure() throws Exception {
        Condition condition = new InstanceOfCondition(String.class);
        assertFalse(condition.check(new Integer(3)));
View Full Code Here


        assertTrue(condition.check(new ArrayList()));
    }

    public void testCheck_Failure() throws Exception {
        Condition condition = new InstanceOfCondition(String.class);
        assertFalse(condition.check(new Integer(3)));
    }

}
View Full Code Here

        Condition condition = createCondition(new Condition[]{
            createFalseCondition(),
            createFalseCondition(),
            createFalseCondition()
        });
        assertFalse(condition.check(new Object()));
    }

    public void testCheck_WhenOneIsTrue() throws Exception {
        Condition condition = createCondition(new Condition[]{
            createFalseCondition(),
View Full Code Here

        Condition condition = createCondition(new Condition[]{
            createFalseCondition(),
            createFalseCondition(),
            createTrueCondition()
        });
        assertTrue(condition.check(new Object()));
    }

}
View Full Code Here

        Condition condition = createCondition(new Condition[]{
            createTrueCondition(),
            createTrueCondition(),
            createTrueCondition()
        });
        assertTrue(condition.check(new Object()));
    }

    public void testCheck_WhenOneIsFalse() throws Exception {
        Condition condition = createCondition(new Condition[]{
            createFalseCondition(),
View Full Code Here

        Condition condition = createCondition(new Condition[]{
            createFalseCondition(),
            createTrueCondition(),
            createTrueCondition()
        });
        assertFalse(condition.check(new Object()));
    }

}
View Full Code Here

        conditionControl.replay();
        ruleControl.replay();

        PropertyValidationRule propertyValidationRule = new PropertyValidationRule("name", rule);
        Condition propertyCondition = propertyValidationRule.getCondition();
        assertTrue(propertyCondition.check(new Person("Uri")));

        conditionControl.verify();
        ruleControl.verify();
    }
View Full Code Here

        conditionControl.replay();
        ruleControl.replay();

        PropertyValidationRule propertyValidationRule = new PropertyValidationRule("name", rule);
        Condition propertyCondition = propertyValidationRule.getCondition();
        assertFalse(propertyCondition.check(new Person("Uri")));

        conditionControl.verify();
        ruleControl.verify();
    }
View Full Code Here

        BeanWrapper wrapper = wrapBean(obj);
        for (int i = 0; i < cascadeValidations.length; i++) {
            CascadeValidation cascadeValidation = cascadeValidations[i];
            Condition applicabilityCondition = cascadeValidation.getApplicabilityCondition();

            if (!applicabilityCondition.check(obj)) {
                continue;
            }

            String propertyName = cascadeValidation.getPropertyName();
            Class propertyType = wrapper.getPropertyType(propertyName);
View Full Code Here

        BeanWrapper wrapper = wrapBean(obj);
        for (int i = 0; i < cascadeValidations.length; i++) {
            CascadeValidation cascadeValidation = cascadeValidations[i];
            Condition applicabilityCondition = cascadeValidation.getApplicabilityCondition();

            if (!applicabilityCondition.check(obj)) {
                continue;
            }

            String propertyName = cascadeValidation.getPropertyName();
            Class propertyType = wrapper.getPropertyType(propertyName);
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.