Package org.apache.tapestry5

Examples of org.apache.tapestry5.ContentTypeTest


    @SuppressWarnings("unchecked")
    @Test
    public void validator_with_constraint() throws Exception
    {
        ValidationMessagesSource messagesSource = mockValidationMessagesSource();
        Validator validator = mockValidator();
        TypeCoercer coercer = mockTypeCoercer();
        FieldComponent field = newFieldComponent();
        Messages messages = mockMessages();
        MessageFormatter formatter = mockMessageFormatter();
View Full Code Here


        MarkupWriter writer = factory.newPartialMarkupWriter(contentType);

        generateResponseMarkup(writer, matchesHolder.get());

        return new TextStreamResponse(contentType.toString(), writer.toString());
    }
View Full Code Here

        train_isRequired(validator, false);
        train_getValueType(validator, Object.class);
        validator.validate(field, 5, formatter, inputValue);

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

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(messagesSource, coercer, fs, map, macro);
View Full Code Here

        train_isRequired(validator, false);
        train_getValueType(validator, Object.class);
        validator.validate(field, 5, formatter, inputValue);

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

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(messagesSource, coercer, fs, map, macro);
View Full Code Here

        train_getContainerMessages(resources, containerMessages);

        train_contains(containerMessages, "myform-fred-minlength", false);
        train_contains(containerMessages, "fred-minlength", false);

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

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(messagesSource, coercer, fs, map, macro);
View Full Code Here

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

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

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(messagesSource, coercer, fs, map, macro);
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test
    public void simple_macro_expansion() throws Exception
    {

        ValidatorMacro macro = mockValidatorMacro();
        expect(macro.valueForMacro("combo")).andReturn("required,minlength=5");
        expect(macro.valueForMacro("required")).andReturn(null);
        expect(macro.valueForMacro("minlength")).andReturn(null);

        replay();

        FieldValidatorSourceImpl source = new FieldValidatorSourceImpl(null, null, null, null, macro);
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test
    public void macros_can_not_have_constraints() throws Exception
    {

        ValidatorMacro macro = mockValidatorMacro();
        expect(macro.valueForMacro("combo")).andReturn("required,minlength=5");

        replay();

        FieldValidatorSourceImpl source = new FieldValidatorSourceImpl(null, null, null, null, macro);
View Full Code Here

    @Test
    public void recursive_macros_are_caught()
    {

        ValidatorMacro macro = mockValidatorMacro();
        expect(macro.valueForMacro("combo")).andReturn("required,combo");
        expect(macro.valueForMacro("required")).andReturn(null);
        expect(macro.valueForMacro("combo")).andReturn("required,combo");

        replay();

        FieldValidatorSourceImpl source = new FieldValidatorSourceImpl(null, null, null, null, macro);
View Full Code Here

        train_isRequired(minLength, false);
        train_getValueType(minLength, String.class);
        minLength.validate(field, fifteen, minLengthFormatter, inputValue);

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

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(messagesSource, coercer, fs, map, macro);
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.ContentTypeTest

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.