Package org.apache.hivemind

Examples of org.apache.hivemind.Messages


        assertEquals("[abbot, costello]", m.format("two-arg", "abbot", "costello"));
    }

    public void testThreeArg() throws Exception
    {
        Messages m = read("config/Localized.xml", Locale.ENGLISH);

        assertEquals("[moe, larry, curly]", m.format("three-arg", "moe", "larry", "curly"));
    }
View Full Code Here


        assertEquals("[moe, larry, curly]", m.format("three-arg", "moe", "larry", "curly"));
    }

    public void testFourArg() throws Exception
    {
        Messages m = read("config/Localized.xml", Locale.ENGLISH);

        assertEquals(
            "[alpha, bravo, delta, gamma]",
            m.format("four-arg", new String[] { "alpha", "bravo", "delta", "gamma" }));
    }
View Full Code Here

            m.format("four-arg", new String[] { "alpha", "bravo", "delta", "gamma" }));
    }

    public void testException() throws Exception
    {
        Messages m = read("config/Localized.xml", Locale.ENGLISH);

        assertEquals(
            "exception: Exception Message",
            m.format("exception", new ApplicationRuntimeException("Exception Message")));
    }
View Full Code Here

            m.format("exception", new ApplicationRuntimeException("Exception Message")));
    }

    public void testExceptionNoMessage() throws Exception
    {
        Messages m = read("config/Localized.xml", Locale.ENGLISH);

        assertEquals(
            "exception: java.lang.NullPointerException",
            m.format("exception", new NullPointerException()));
    }
View Full Code Here

        ErrorHandler eh = new DefaultErrorHandler();
        ClassResolver cr = new DefaultClassResolver();

        MockControl messagesControl = newControl(Messages.class);
        Messages messages = (Messages) messagesControl.getMock();

        module.getClassResolver();
        c.setReturnValue(cr);

        module.getClassResolver();
View Full Code Here

     * Test the use of the '%key' construct as the message.
     */

    public void testMessageOverrideAsReference()
    {
        Messages messages = newMessage("myfield-required", "Yo Dawg! Gimme a piece of {0}.");
        IComponent container = newComponent(messages);
        IFormComponent field = newField(container);

        ValidationMessages m = new ValidationMessagesImpl(field, Locale.ENGLISH);

View Full Code Here

    }

    private Messages newMessage(String key, String message)
    {
        MockControl control = newControl(Messages.class);
        Messages messages = (Messages) control.getMock();

        messages.getMessage(key);
        control.setReturnValue(message);

        return messages;
    }
View Full Code Here

    }

    public void testNoParams()
    {
        MockControl control = newControl(Messages.class);
        Messages messages = (Messages) control.getMock();

        messages.getMessage("no-params");
        control.setReturnValue("<no params>");

        MessagesTarget mt = (MessagesTarget) construct(MessagesTarget.class, "noParams", messages);

        replayControls();
View Full Code Here

    }

    public void testObjectParam()
    {
        MockControl control = newControl(Messages.class);
        Messages messages = (Messages) control.getMock();

        Object[] params = new Object[]
        { "PinkFloyd" };

        messages.format("object-param", params);
        control.setMatcher(new ArrayMatcher());
        control.setReturnValue("<object param>");

        MessagesTarget mt = (MessagesTarget) construct(
                MessagesTarget.class,
View Full Code Here

    public void testPrimitiveParam()
    {

        MockControl control = newControl(Messages.class);
        Messages messages = (Messages) control.getMock();

        Object[] params = new Object[]
        { 451 };

        messages.format("primitive-param", params);
        control.setMatcher(new ArrayMatcher());
        control.setReturnValue("<primitive param>");

        MessagesTarget mt = (MessagesTarget) construct(
                MessagesTarget.class,
View Full Code Here

TOP

Related Classes of org.apache.hivemind.Messages

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.