KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > puppycrawl > tools > checkstyle > checks > TranslationCheckTest


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

45 }
46
Popular Tags