@Test public void shouldNotFindMissingLocale() { String html = manager.messageFromFile( Locale.CHINA, "ArchitectureRule.html", "checkstyle.rule1.name" /* any property in the same bundle */, false); assertThat(html, nullValue()); }
@Test public void shouldFindFrenchFile() { String html = manager.messageFromFile( Locale.FRENCH, "ArchitectureRule.html", "checkstyle.rule1.name" /* any property in the same bundle */, false); assertThat(html, Is.is("Règle d'architecture")); }
@Test public void shouldNotFindFile() { String html = manager.messageFromFile( Locale.ENGLISH, "UnknownRule.html", "checkstyle.rule1.name" /* any property in the same bundle */, false); assertThat(html, nullValue()); }
@Test public void shouldFindEnglishFile() { String html = manager.messageFromFile( Locale.ENGLISH, "ArchitectureRule.html", "checkstyle.rule1.name" /* * any property in the same * bundle */, false); assertThat(html, Is.is("This is the architecture rule")); }
@Test public void shouldNotKeepInCache() { assertThat(manager.getFileContentCache().size(), Is.is(0)); boolean keepInCache = false; String html = manager.messageFromFile( Locale.ENGLISH, "ArchitectureRule.html", "checkstyle.rule1.name" /* * any property in the same * bundle */, keepInCache); assertThat(html, not(nullValue())); assertThat(manager.getFileContentCache().size(), Is.is(0)); }
@Test public void shouldKeepInCache() { assertThat(manager.getFileContentCache().size(), Is.is(0)); boolean keepInCache = true; String html = manager.messageFromFile( Locale.ENGLISH, "ArchitectureRule.html", "checkstyle.rule1.name" /* * any property in the same * bundle */, keepInCache); assertThat(html, not(nullValue())); Map<String, Map<Locale, String>> cache = manager.getFileContentCache(); assertThat(cache.size(), Is.is(1)); assertThat( cache.get("ArchitectureRule.html").get(Locale.ENGLISH), Is.is("This is the architecture rule")); }