Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/puppycrawl/tools/checkstyle/checks/TranslationCheckTest.java


1   package com.puppycrawl.tools.checkstyle.checks;
2   
3   import java.io.File;
4   
5   import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
6   import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
7   import com.puppycrawl.tools.checkstyle.api.Configuration;
8   
9   public class TranslationCheckTest
10      extends BaseCheckTestCase
11  {
12      protected DefaultConfiguration createCheckerConfig(Configuration aCheckConfig)
13      {
14          final DefaultConfiguration dc = new DefaultConfiguration("root");
15          dc.addChild(aCheckConfig);
16          return dc;
17      }
18  
19      public void testTranslation()
20           throws Exception
21      {
22          final Configuration checkConfig = createCheckConfig(TranslationCheck.class);
23          final String[] expected = {
24              "0: Key 'only.english' missing."
25          };
26          final File[] propertyFiles = new File[] {
27              new File(getPath("messages_de.properties")),
28              new File(getPath("messages.properties"))
29          };
30          verify(
31              createChecker(checkConfig),
32              propertyFiles,
33              getPath("messages_de.properties"),
34              expected);
35      }
36  
37      // TODO: test with the same resourcebundle name in different packages
38      // x/messages.properties
39      //     key1=x
40      // y/messages.properties
41      //     key2=y
42      // should not result in error message about key1 missing in the y bundle
43  
44  }