Package org.apache.tapestry.coerce

Examples of org.apache.tapestry.coerce.ValueConverter


    }

    public void testValidateNoValidators()
    {
        MockControl converterControl = newControl(ValueConverter.class);
        ValueConverter converter = (ValueConverter) converterControl.getMock();
       
        ValidatableFieldSupportImpl support = new ValidatableFieldSupportImpl();
        support.setThreadLocale(newThreadLocale());
        support.setValueConverter(converter);
       
        MockControl fieldControl = newControl(TranslatedField.class);
        TranslatedField field = (TranslatedField) fieldControl.getMock();
       
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
       
        Object object = new Object();

        field.getValidators();
        fieldControl.setReturnValue(null);
       
        converter.coerceValue(null, Iterator.class);
        converterControl.setReturnValue(Collections.EMPTY_LIST.iterator());
       
        try
        {
            replayControls();
View Full Code Here


    }

    public void testValidateAcceptNull()
    {
        MockControl converterControl = newControl(ValueConverter.class);
        ValueConverter converter = (ValueConverter) converterControl.getMock();
       
        ValidatableFieldSupportImpl support = new ValidatableFieldSupportImpl();
        support.setThreadLocale(newThreadLocale());
        support.setValueConverter(converter);
       
        MockControl fieldControl = newControl(TranslatedField.class);
        TranslatedField field = (TranslatedField) fieldControl.getMock();
       
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
       
        MockControl validatorControl = newControl(Validator.class);
        Validator validator = (Validator) validatorControl.getMock();
       
        field.getValidators();
        fieldControl.setReturnValue(validator);
       
        converter.coerceValue(validator, Iterator.class);
        converterControl.setReturnValue(Collections.singleton(validator).iterator());

        validator.getAcceptsNull();
        validatorControl.setReturnValue(true);
View Full Code Here

    }

    public void testValidateRejectNull()
    {
        MockControl converterControl = newControl(ValueConverter.class);
        ValueConverter converter = (ValueConverter) converterControl.getMock();
       
        ValidatableFieldSupportImpl support = new ValidatableFieldSupportImpl();
        support.setThreadLocale(newThreadLocale());
        support.setValueConverter(converter);
       
        MockControl fieldControl = newControl(TranslatedField.class);
        TranslatedField field = (TranslatedField) fieldControl.getMock();
       
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
       
        MockControl validatorControl = newControl(Validator.class);
        Validator validator = (Validator) validatorControl.getMock();
       
        field.getValidators();
        fieldControl.setReturnValue(validator);
       
        converter.coerceValue(validator, Iterator.class);
        converterControl.setReturnValue(Collections.singleton(validator).iterator());

        validator.getAcceptsNull();
        validatorControl.setReturnValue(false);
       
View Full Code Here

    }

    private ValueConverter newValueConverter(Collection validators)
    {
        MockControl control = newControl(ValueConverter.class);
        ValueConverter converter = (ValueConverter) control.getMock();

        converter.coerceValue(validators, Iterator.class);
        control.setReturnValue(validators.iterator());

        return converter;
    }
View Full Code Here

    public void testIsRequiredNoValidators()
    {
        Collection validators = Collections.EMPTY_LIST;
        ValidatableField field = newFieldGetValidators(validators);
        ValueConverter converter = newValueConverter(validators);

        replayControls();

        ValidatableFieldSupportImpl support = new ValidatableFieldSupportImpl();
        support.setValueConverter(converter);
View Full Code Here

    public void testIsRequiredNoRequiredValidators()
    {
        Collection validators = Collections.singletonList(newValidator(false));
        ValidatableField field = newFieldGetValidators(validators);
        ValueConverter converter = newValueConverter(validators);

        replayControls();

        ValidatableFieldSupportImpl support = new ValidatableFieldSupportImpl();
        support.setValueConverter(converter);
View Full Code Here

    public void testIsRequiredWithRequiredValidator()
    {
        Collection validators = Collections.singletonList(newValidator(true));
        ValidatableField field = newFieldGetValidators(validators);
        ValueConverter converter = newValueConverter(validators);

        replayControls();

        ValidatableFieldSupportImpl support = new ValidatableFieldSupportImpl();
        support.setValueConverter(converter);
View Full Code Here

    }

    private ValueConverter newValueConverter(Collection validators)
    {
        MockControl control = newControl(ValueConverter.class);
        ValueConverter converter = (ValueConverter) control.getMock();

        converter.coerceValue(validators, Iterator.class);
        control.setReturnValue(validators.iterator());

        return converter;
    }
View Full Code Here

    public void testIsRequiredNoValidators()
    {
        Collection validators = Collections.EMPTY_LIST;
        ValidatableField field = newFieldGetValidators(validators);
        ValueConverter converter = newValueConverter(validators);

        replayControls();

        ValidatableFieldSupportImpl support = new ValidatableFieldSupportImpl();
        support.setValueConverter(converter);
View Full Code Here

    public void testIsRequiredNoRequiredValidators()
    {
        Collection validators = Collections.singletonList(newValidator(false));
        ValidatableField field = newFieldGetValidators(validators);
        ValueConverter converter = newValueConverter(validators);

        replayControls();

        ValidatableFieldSupportImpl support = new ValidatableFieldSupportImpl();
        support.setValueConverter(converter);
View Full Code Here

TOP

Related Classes of org.apache.tapestry.coerce.ValueConverter

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.