MessageUtil { public static String getMessage(String code) { return getMessage(code, null); } protected  MessageUtil(); static String getMessage(String code); static String getMessage(String code, Object[] args); static void setMessageAccessor(MessageAccessor messageAccessor); static void removeMessageAccessor();  }
@Test public void testGetMessage01() throws Exception { String result = MessageUtil.getMessage("errors.alphaNumericString"); assertEquals("{0}には半角英数字で入力してください.", result); }
@Test public void testGetMessage02() throws Exception { String[] args = { "test1" }; String result = MessageUtil.getMessage("errors.alphaNumericString", args); assertEquals("test1には半角英数字で入力してください.", result); }
@Test public void testGetMessage03() throws Exception { Object[] args = { "test1", 10, 20 }; String result = MessageUtil.getMessage("errors.range", args); assertEquals("test1には10から20までの範囲で入力してください.", result); }
@Test public void testGetMessage04() throws Exception { String[] args = { "test1" }; String result = MessageUtil.getMessage("test", args); assertNotNull(result); assertEquals("Message not found. CODE:[test]", result); }
@Test public void testGetMessage05() throws Exception { String result = MessageUtil.getMessage(null); assertNotNull(result); assertEquals("Message not found. CODE:[null]", result); }