01: package org.objectweb.celtix.common.i18n;
02:
03: import java.util.ResourceBundle;
04: import java.util.logging.Logger;
05:
06: import junit.framework.TestCase;
07:
08: import org.objectweb.celtix.common.logging.LogUtils;
09:
10: public class MessageTest extends TestCase {
11: private static final Logger LOG = LogUtils
12: .getL7dLogger(MessageTest.class);
13:
14: public void testMessageWithLoggerBundle() throws Exception {
15: Message msg = new Message("SUB1_EXC", LOG, new Object[] { 1 });
16: assertSame("unexpected resource bundle", LOG
17: .getResourceBundle(), msg.bundle);
18: assertEquals("unexpected message string", "subbed in 1 only",
19: msg.toString());
20: }
21:
22: public void testMessageWithExplicitBundle() throws Exception {
23: ResourceBundle bundle = BundleUtils.getBundle(getClass());
24: Message msg = new Message("SUB2_EXC", bundle, new Object[] { 3,
25: 4 });
26: assertSame("unexpected resource bundle", bundle, msg.bundle);
27: assertEquals("unexpected message string", "subbed in 4 & 3",
28: msg.toString());
29: }
30: }
|