Example #1
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));
  }
Example #2
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"));
  }