Пример #1
0
 @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());
 }
Пример #2
0
 @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"));
 }
Пример #3
0
 @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());
 }
Пример #4
0
 @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"));
 }
Пример #5
0
  @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));
  }
Пример #6
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"));
  }