Package org.apache.tapestry.beaneditor

Examples of org.apache.tapestry.beaneditor.Validate


    @Test
    public void single_constraint()
    {
        PropertyConduit conduit = mockPropertyConduit();
        Validate validate = newValidate("required");

        train_getAnnotation(conduit, Validate.class, validate);

        replay();
View Full Code Here


    @Test
    public void multiple_constraints()
    {
        PropertyConduit conduit = mockPropertyConduit();
        Validate validate = newValidate("required,minlength=3");

        train_getAnnotation(conduit, Validate.class, validate);

        replay();
View Full Code Here

        verify();
    }

    private Validate newValidate(String value)
    {
        Validate annotation = newMock(Validate.class);

        expect(annotation.value()).andReturn(value).atLeastOnce();

        return annotation;
    }
View Full Code Here

public class ValidateAnnotationConstraintGenerator implements ValidationConstraintGenerator
{

    public List<String> buildConstraints(Class propertyType, AnnotationProvider annotationProvider)
    {
        Validate annotation = annotationProvider.getAnnotation(Validate.class);

        if (annotation == null)
            return null;

        return Arrays.asList(annotation.value().split(","));
    }
View Full Code Here

    @Test
    public void single_constraint()
    {
        PropertyConduit conduit = mockPropertyConduit();
        Validate validate = newValidate("required");

        train_getAnnotation(conduit, Validate.class, validate);

        replay();
View Full Code Here

    @Test
    public void multiple_constraints()
    {
        PropertyConduit conduit = mockPropertyConduit();
        Validate validate = newValidate("required,minlength=3");

        train_getAnnotation(conduit, Validate.class, validate);

        replay();
View Full Code Here

        verify();
    }

    private Validate newValidate(String value)
    {
        Validate annotation = newMock(Validate.class);

        expect(annotation.value()).andReturn(value).atLeastOnce();

        return annotation;
    }
View Full Code Here

    @Test
    public void single_constraint()
    {
        PropertyConduit conduit = newPropertyConduit();
        Validate validate = newValidate("required");

        train_getAnnotation(conduit, Validate.class, validate);

        replay();
View Full Code Here

    @Test
    public void multiple_constraints()
    {
        PropertyConduit conduit = newPropertyConduit();
        Validate validate = newValidate("required,minlength=3");

        train_getAnnotation(conduit, Validate.class, validate);

        replay();
View Full Code Here

        verify();
    }

    private Validate newValidate(String value)
    {
        Validate annotation = newMock(Validate.class);

        expect(annotation.value()).andReturn(value).atLeastOnce();

        return annotation;
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry.beaneditor.Validate

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.