Package com.kre8orz.i18n.mockup

Examples of com.kre8orz.i18n.mockup.MessagerMockup


public class I18NProcessorMessagesTest {

    @Test
    public void testFormattingMethods() {
        MessagerMockup host = new MessagerMockup();
        I18NProcessorMessages msgs = new I18NProcessorMessages(host, Locale.ROOT, Kind.ERROR);
        Element ele = null;
        Object[] args = new String[] { "foo", "bar" };
        String note = I18NProcessorMessages.OPTION_SET_TO;
        String msg = msgs.format(Kind.ERROR, note, ele, args);
View Full Code Here


        AnnotationValue aValue = null;
        Element ele = null;
        Object[] args = null;

        for (Kind kind : Kind.values()) {
            MessagerMockup host = new MessagerMockup();
            I18NProcessorMessages msgs = new I18NProcessorMessages(host, Locale.ROOT, kind);

            for (Kind msgKind : Kind.values()) {
                msgs.format(msgKind, CANNOT_OPEN_BUNDLE, args);
                msgs.format(msgKind, CANNOT_OPEN_BUNDLE, ele, args);
                msgs.format(msgKind, CANNOT_OPEN_BUNDLE, ele, aMirror, args);
                msgs.format(msgKind, CANNOT_OPEN_BUNDLE, ele, aMirror, aValue, args);
                msgs.record(msgKind, CANNOT_OPEN_BUNDLE);
                msgs.record(msgKind, CANNOT_OPEN_BUNDLE, ele);
                msgs.record(msgKind, CANNOT_OPEN_BUNDLE, ele, aMirror);
                msgs.record(msgKind, CANNOT_OPEN_BUNDLE, ele, aMirror, aValue);
            }

            for (Kind msgKind : Kind.values()) {

                if (msgKind.ordinal() <= kind.ordinal()) {
                    assertTrue(host.getCount(msgKind) == 8);
                } else {
                    assertTrue(host.getCount(msgKind) == 0);
                }
            }
        }
    }
View Full Code Here

        }
    }

    @Test
    public void testRecordingMethods() {
        MessagerMockup host = new MessagerMockup();
        I18NProcessorMessages msgs = new I18NProcessorMessages(host, Locale.ROOT, Kind.ERROR);
        Element ele = null;
        String note = I18NProcessorMessages.OPTION_SET_TO;
        String msg;
        msgs.record(Kind.ERROR, note);
        assertTrue(host.getCount(Kind.ERROR) == 1);
        host = new MessagerMockup();
        msgs = new I18NProcessorMessages(host, Locale.ROOT, Kind.ERROR);
        msgs.record(Kind.ERROR, note, ele);
        assertTrue(host.getCount(Kind.ERROR) == 1);
        host = new MessagerMockup();
        msgs = new I18NProcessorMessages(host, Locale.ROOT, Kind.ERROR);

        AnnotationMirror aMirror = null;
        msgs.record(Kind.ERROR, note, ele, aMirror);
        assertTrue(host.getCount(Kind.ERROR) == 1);
        host = new MessagerMockup();
        msgs = new I18NProcessorMessages(host, Locale.ROOT, Kind.ERROR);

        AnnotationValue aValue = null;
        msgs.record(Kind.ERROR, note, ele, aMirror, aValue);
        assertTrue(host.getCount(Kind.ERROR) == 1);
    }
View Full Code Here

                    return args;
                }

                @Override
                public Messager getMessager() {
                    return new MessagerMockup();
                }
            };

        String badData = Long.toHexString(new Date().getTime());
        args.put(prefix + ".catalogClass", null);
View Full Code Here

                    return args;
                }

                @Override
                public Messager getMessager() {
                    return new MessagerMockup();
                }
            };
        options = new I18NProcessorOptions(pe);

        Locale expectedLocale = new Locale("en", "US");
View Full Code Here

TOP

Related Classes of com.kre8orz.i18n.mockup.MessagerMockup

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.