Package org.apache.tapestry.ioc

Examples of org.apache.tapestry.ioc.MessageFormatter


    @SuppressWarnings("unchecked")
    @Test
    public void nonmatching_value_type_skipped() throws Exception
    {
        Field field = newField();
        MessageFormatter formatter = newMessageFormatter();
        Validator validator = newValidator();
        Integer value = 15;

        train_invokeIfBlank(validator, true);
        train_getValueType(validator, String.class);
View Full Code Here


    @SuppressWarnings("unchecked")
    @Test
    public void value_type_check_skipped_for_null_values() throws Exception
    {
        Field field = newField();
        MessageFormatter formatter = newMessageFormatter();
        Validator validator = newValidator();

        train_invokeIfBlank(validator, true);

        validator.validate(field, null, formatter, null);
View Full Code Here

    @Test
    public void message_formatter()
    {
        Messages messages = _source.getValidationMessages(Locale.ENGLISH);

        MessageFormatter formatter = messages.getFormatter("required");

        assertEquals(formatter.format("My Field"), "You must provide a value for My Field.");
    }
View Full Code Here

        ValidationMessagesSource messagesSource = newValidationMessagesSource();
        Validator validator = newValidator();
        TypeCoercer coercer = newTypeCoercer();
        FieldComponent field = newFieldComponent();
        Messages messages = newMessages();
        MessageFormatter formatter = newMessageFormatter();
        Object inputValue = new Object();
        ComponentResources resources = newComponentResources();
        Messages containerMessages = newMessages();
        Integer five = 5;
View Full Code Here

        ValidationMessagesSource messagesSource = newValidationMessagesSource();
        Validator validator = newValidator();
        TypeCoercer coercer = newTypeCoercer();
        FieldComponent field = newFieldComponent();
        Messages messages = newMessages();
        MessageFormatter formatter = newMessageFormatter();
        Object inputValue = new Object();
        ComponentResources resources = newComponentResources();
        Messages containerMessages = newMessages();

        Map<String, Validator> map = singletonMap("required", validator);
View Full Code Here

    {
        ValidationMessagesSource messagesSource = newValidationMessagesSource();
        Validator validator = newValidator();
        TypeCoercer coercer = newTypeCoercer();
        FieldComponent field = newFieldComponent();
        MessageFormatter formatter = newMessageFormatter();
        Object inputValue = new Object();
        ComponentResources resources = newComponentResources();
        Messages containerMessages = newMessages();

        Map<String, Validator> map = singletonMap("required", validator);
View Full Code Here

        ValidationMessagesSource messagesSource = newValidationMessagesSource();
        Validator validator = newValidator();
        TypeCoercer coercer = newTypeCoercer();
        FieldComponent field = newFieldComponent();
        Messages messages = newMessages();
        MessageFormatter formatter = newMessageFormatter();
        Object inputValue = new Object();
        ComponentResources resources = newComponentResources();
        Messages containerMessages = newMessages();

        Map<String, Validator> map = singletonMap("required", validator);
View Full Code Here

        Validator required = newValidator();
        Validator minLength = newValidator();
        TypeCoercer coercer = newTypeCoercer();
        FieldComponent field = newFieldComponent();
        Messages messages = newMessages();
        MessageFormatter requiredFormatter = newMessageFormatter();
        MessageFormatter minLengthFormatter = newMessageFormatter();
        Object inputValue = "input value";
        ComponentResources resources = newComponentResources();
        Messages containerMessages = newMessages();
        Integer fifteen = 15;
View Full Code Here

        return String.format("[[missing key: %s]]", key);
    }

    public MessageFormatter getFormatter(String key)
    {
        MessageFormatter result = _cache.get(key);

        if (result == null)
        {
            result = buildMessageFormatter(key);
            _cache.put(key, result);
View Full Code Here

    }

    @Test
    public void get_formatter()
    {
        MessageFormatter mf = _messages.getFormatter("result");

        assertEquals(mf.format("great"), "The result is 'great'.");
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry.ioc.MessageFormatter

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.