Package org.springmodules.validation.util.condition

Examples of org.springmodules.validation.util.condition.Condition


        }
        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


    public boolean supports(Element element, Class clazz, PropertyDescriptor descriptor) {
        return element.getLocalName().equals("is-first-letter-capitalized");
    }

    public void handle(Element element, String propertyName, MutableBeanValidationConfiguration configuration) {
        Condition cond = new AbstractCondition() {
            public boolean doCheck(Object object) {
                String text = (String) object;
                if (text.length() == 0) {
                    return false;
                }
View Full Code Here

    public void testCheck_Success() throws Exception {
        Object object = new Object();
        predicateControl.expectAndReturn(predicate.evaluate(object), true);
        predicateControl.replay();

        Condition condition = new CommonsPredicateCondition(predicate);
        assertTrue(condition.check(object));

        predicateControl.verify();
    }
View Full Code Here

    public void testCheck_Failure() throws Exception {
        Object object = new Object();
        predicateControl.expectAndReturn(predicate.evaluate(object), false);
        predicateControl.replay();

        Condition condition = new CommonsPredicateCondition(predicate);
        assertFalse(condition.check(object));

        predicateControl.verify();
    }
View Full Code Here

            // expected
        }
    }

    public void testCheck_Success() throws Exception {
        Condition condition = new NotCondition(createFalseCondition());
        assertTrue(condition.check(new Object()));
    }
View Full Code Here

        Condition condition = new NotCondition(createFalseCondition());
        assertTrue(condition.check(new Object()));
    }

    public void testCheck_Failure() throws Exception {
        Condition condition = new NotCondition(createTrueCondition());
        assertFalse(condition.check(new Object()));
    }
View Full Code Here

            // expected
        }
    }

    public void testCheck_Success() throws Exception {
        Condition condition = new InstanceOfCondition(String.class);
        assertTrue(condition.check("test"));
    }
View Full Code Here

        Condition condition = new InstanceOfCondition(String.class);
        assertTrue(condition.check("test"));
    }

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

        String[] applicableContexts = extractApplicableContexts(annotation);
        if (applicableContexts != null) {
            rule.setContextTokens(applicableContexts);
        }

        Condition applicabilityCondition = extractApplicabilityContidion(annotation);
        if (applicabilityCondition != null) {
            rule.setApplicabilityCondition(applicabilityCondition);
        }

        configuration.addGlobalRule(rule);
View Full Code Here

        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

TOP

Related Classes of org.springmodules.validation.util.condition.Condition

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.