Package org.apache.tapestry5.services

Examples of org.apache.tapestry5.services.FieldValidatorSource


    @Test
    public void success()
    {

        FieldValidatorSource source = mockFieldValidatorSource();
        ComponentResources container = mockComponentResources();
        ComponentResources component = mockComponentResources();
        FieldComponent instance = mockFieldComponent();
        Location l = mockLocation();
        FieldValidator validator = mockFieldValidator();

        String expression = "required,minLength=5";

        train_getComponent(component, instance);

        expect(source.createValidators(instance, expression)).andReturn(validator);

        replay();

        BindingFactory factory = new ValidateBindingFactory(source, interner);
View Full Code Here


    private StringInterner interner = new StringInternerImpl();

    @Test
    public void not_a_field()
    {
        FieldValidatorSource source = mockFieldValidatorSource();
        ComponentResources container = mockComponentResources();
        ComponentResources component = mockComponentResources();
        Component instance = mockComponent();
        Location l = mockLocation();
View Full Code Here

    @Test
    public void success()
    {

        FieldValidatorSource source = mockFieldValidatorSource();
        ComponentResources container = mockComponentResources();
        ComponentResources component = mockComponentResources();
        FieldComponent instance = mockFieldComponent();
        Location l = mockLocation();
        FieldValidator validator = mockFieldValidator();

        String expression = "required,minLength=5";

        train_getComponent(component, instance);

        expect(source.createValidators(instance, expression)).andReturn(validator);

        replay();

        BindingFactory factory = new ValidateBindingFactory(source, interner);
View Full Code Here

        map.put("alpha", validator);
        map.put("beta", validator);

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(null, coercer, null, map, macro);

        try
        {
            source.createValidator(field, "foo", null);
            unreachable();
        }
        catch (IllegalArgumentException ex)
        {
            assertEquals(ex.getMessage(), "Unknown validator type 'foo'. Configured validators are alpha, beta.");
View Full Code Here

        train_getValueType(validator, Object.class);
        validator.validate(field, null, formatter, inputValue);

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(globalMessages, coercer, fs, map, macro);

        FieldValidator fieldValidator = source.createValidator(field, "required", null);

        fieldValidator.validate(inputValue);

        verify();
    }
View Full Code Here

        train_getValueType(validator, Object.class);
        validator.validate(field, null, formatter, inputValue);

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(null, coercer, fs, map, macro);

        FieldValidator fieldValidator = source.createValidator(field, "required", null);

        fieldValidator.validate(inputValue);

        verify();
    }
View Full Code Here

        train_getValueType(validator, Object.class);
        validator.validate(field, null, formatter, inputValue);

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(null, coercer, fs, map, macro);

        FieldValidator fieldValidator = source.createValidator(field, "required", null);

        fieldValidator.validate(inputValue);

        verify();
    }
View Full Code Here

        ValidatorMacro macro = mockValidatorMacro();
        train_alwaysNull(macro);

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(globalMessages, coercer, fs, map, macro);

        FieldValidator fieldValidator = source.createValidators(field, "minlength");

        fieldValidator.validate(inputValue);

        verify();
    }
View Full Code Here

        ValidatorMacro macro = mockValidatorMacro();
        train_alwaysNull(macro);

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(globalMessages, coercer, fs, map, macro);

        FieldValidator fieldValidator = source.createValidators(field, "minlength");

        fieldValidator.validate(inputValue);

        verify();
    }
View Full Code Here

        ValidatorMacro macro = mockValidatorMacro();
        train_alwaysNull(macro);

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(null, coercer, fs, map, macro);

        try
        {
            source.createValidators(field, "minlength");
            unreachable();
        }
        catch (IllegalArgumentException ex)
        {
            assertEquals(
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.services.FieldValidatorSource

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.