1   package com.atlassian.sal.core.message;
2   
3   import com.atlassian.sal.api.message.I18nResolver;
4   import com.atlassian.sal.api.message.Message;
5   import junit.framework.TestCase;
6   
7   import java.io.Serializable;
8   import java.util.Locale;
9   import java.util.Map;
10  
11  public class TestAbstractI18nResolver extends TestCase
12  {
13      private I18nResolver assertingResolver = new AbstractI18nResolver() {
14          @Override
15          public String resolveText(String key, Serializable[] arguments)
16          {
17              assertEquals(0, arguments.length);
18              return "";
19          }
20  
21          public Map<String, String> getAllTranslationsForPrefix(String prefix)
22          {
23              throw new UnsupportedOperationException();
24          }
25  
26          public Map<String, String> getAllTranslationsForPrefix(String prefix, Locale locale)
27          {
28              throw new UnsupportedOperationException();
29          }
30  
31          public String getRawText(final String key)
32          {
33              throw new UnsupportedOperationException();
34          }
35      };
36  
37      public void testGetTextWithOnlyKeyParameter()
38      {
39          assertingResolver.getText("hello world");
40      }
41  
42      public void testGetTextWithMessageParameterWithZeroArgument()
43      {
44          Message message = new DefaultMessage("fun");
45          assertingResolver.getText(message);
46      }
47  }