01: package com.puppycrawl.tools.checkstyle.checks;
02:
03: import java.io.File;
04:
05: import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
06: import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
07: import com.puppycrawl.tools.checkstyle.api.Configuration;
08:
09: public class TranslationCheckTest extends BaseCheckTestCase {
10: protected DefaultConfiguration createCheckerConfig(
11: Configuration aCheckConfig) {
12: final DefaultConfiguration dc = new DefaultConfiguration("root");
13: dc.addChild(aCheckConfig);
14: return dc;
15: }
16:
17: public void testTranslation() throws Exception {
18: final Configuration checkConfig = createCheckConfig(TranslationCheck.class);
19: final String[] expected = { "0: Key 'only.english' missing." };
20: final File[] propertyFiles = new File[] {
21: new File(getPath("messages_de.properties")),
22: new File(getPath("messages.properties")) };
23: verify(createChecker(checkConfig), propertyFiles,
24: getPath("messages_de.properties"), expected);
25: }
26:
27: // TODO: test with the same resourcebundle name in different packages
28: // x/messages.properties
29: // key1=x
30: // y/messages.properties
31: // key2=y
32: // should not result in error message about key1 missing in the y bundle
33:
34: }
|