Package org.apache.myfaces.extensions.cdi.message.impl

Examples of org.apache.myfaces.extensions.cdi.message.impl.NumberedArgumentAwareMessageInterpolator


    }

    @Test
    public void createNumberedArgumentAwareMessageTest()
    {
        MessageInterpolator messageInterpolator = new CompositeMessageInterpolator(createELAwareInterpolator(), new NumberedArgumentAwareMessageInterpolator());
        String messageText = this.messageContext.config().change().messageInterpolator(messageInterpolator).create()
                .message().text("\\{0} greets {1}")
                .argument("Gerhard", "Manfred").argument(new TestPerson()).toText();

        assertEquals("Gerhard greets Manfred", messageText);
View Full Code Here


    }

    @Test
    public void createMixedArgumentAwareMessageTest()
    {
        MessageInterpolator messageInterpolator = new CompositeMessageInterpolator(createELAwareInterpolator(), new NumberedArgumentAwareMessageInterpolator());
        String messageText = this.messageContext.config().change().messageInterpolator(messageInterpolator).create()
                .message().text("[hello] {0} and {firstName} ({1} and {lastName}) greet {person.name}")
                .argument("Gerhard", "Petracek")
                .namedArgument("person", new TestPerson())
                .namedArgument("lastName", "Geiler").namedArgument("firstName", "Manfred").toText();
View Full Code Here

    }

    @Test
    public void createMixedArgumentAwareMessageWithSimpleNamedArgumentMessageInterpolatorTest()
    {
        MessageInterpolator messageInterpolator = new CompositeMessageInterpolator(new NamedArgumentMessageInterpolator(), new NumberedArgumentAwareMessageInterpolator());
        String messageText = this.messageContext.config().change().messageInterpolator(messageInterpolator).create()
                .message().text("[hello] {0} and {firstName} ({1} and {lastName})")
                .argument("Gerhard", "Petracek")
                .namedArgument("person", new TestPerson())
                .namedArgument("firstName", "Manfred")
View Full Code Here

{
    @Test
    public void createMessageWithLocalizableNumberedAttributeTest()
    {
        String messageText = this.messageContext.config().use()
                .messageInterpolator(new NumberedArgumentAwareMessageInterpolator()).create()
                .message().text("{info}").argument(new TestCar()).toText();

        assertEquals("value: jCar", messageText);
    }
View Full Code Here

    {
        TestArgument dynArgument = new TestArgument("brand_key");

        Assert.assertEquals("{brand_key}", dynArgument.getKey());

        String messageText = this.messageContext.config().use().messageInterpolator(new NumberedArgumentAwareMessageInterpolator()).create()
                .message().text("{info}").argument(dynArgument.getKey()).toText();

        Assert.assertEquals("jCar", dynArgument.toString(this.messageContext));
        assertEquals("value: jCar", messageText);
    }
View Full Code Here

            }
        };

        Assert.assertEquals("brand-value", dynArgument.getKey());

        String messageText = this.messageContext.config().use().messageInterpolator(new NumberedArgumentAwareMessageInterpolator()).create()
                .message().text("{info}").argument(dynArgument.getKey()).toText();

        assertEquals("value: brand-value", messageText);
    }
View Full Code Here

    public void messageContextConfigSerializationTest()
    {
        this.messageContext.config()
                .change()
                .messageResolver(new TestMessageResolver())
                .messageInterpolator(new NumberedArgumentAwareMessageInterpolator())
                .localeResolver(new TestCustomMessageContext())
                .addMessageHandler(new TestInMemoryMessageHandler())
                .formatterFactory(new DefaultFormatterFactory())
                .addFormatter(new TestFormatter(String.class))
                .addFormatterConfig(Number.class, new TestEnglishNumberConfig(), Locale.ENGLISH);
View Full Code Here

public class FormattedMessageArgumentTest extends AbstractMessageContextAwareTest
{
    @Test
    public void createFormattedMessageGermanTest()
    {
        String messageText = this.messageContext.config().use().messageInterpolator(new NumberedArgumentAwareMessageInterpolator())
                .localeResolver(new TestGermanLocaleResolver())
                .create()
                .message().text("{formatted_number}").argument(new BigDecimal("7654.3210")).toText();

        assertEquals("value: 7.654,321", messageText);
View Full Code Here

    }

    @Test
    public void createFormattedMessageEnglishTest()
    {
        String messageText = this.messageContext.config().use().messageInterpolator(new NumberedArgumentAwareMessageInterpolator())
                .localeResolver(new TestEnglishLocaleResolver())
                .create()
                .message().text("{formatted_number}").argument(new BigDecimal("7654.3210")).toText();

        assertEquals("value: 7,654.321", messageText);
View Full Code Here

    }

    @Test
    public void createCustomFormattedMessageEnglishTest()
    {
        String messageText = this.messageContext.config().use().messageInterpolator(new NumberedArgumentAwareMessageInterpolator())
                .localeResolver(new TestEnglishLocaleResolver())
                .addFormatterConfig(Number.class, new TestCustomNumberConfig(), Locale.ENGLISH)
                .create()
                .message().text("{formatted_number}").argument(new BigDecimal("7654.3210")).toText();
View Full Code Here

TOP

Related Classes of org.apache.myfaces.extensions.cdi.message.impl.NumberedArgumentAwareMessageInterpolator

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.