@Test
  public void override_existing() {
    when(i18n.getName("squid", "S0001")).thenReturn("SOne");
    when(i18n.getDescription("squid", "S0001")).thenReturn("S One");

    RulesDefinition.Context context = new RulesDefinition.Context();
    RulesDefinition.NewRepository repo = context.createRepository("squid", "java");
    repo.createRule("S0001").setName("Bad").setHtmlDescription("Bad");

    loader.load(repo);
    repo.done();

    RulesDefinition.Rule rule = context.repository("squid").rule("S0001");
    assertThat(rule.name()).isEqualTo("SOne");
    assertThat(rule.htmlDescription()).isEqualTo("S One");
  }
  @Test
  public void complete_rule_name_and_description() {
    when(i18n.getName("squid", "S0001")).thenReturn("SOne");
    when(i18n.getDescription("squid", "S0001")).thenReturn("S One");

    RulesDefinition.Context context = new RulesDefinition.Context();
    RulesDefinition.NewRepository repo = context.createRepository("squid", "java");
    // rule without description
    repo.createRule("S0001");

    loader.load(repo);
    repo.done();

    RulesDefinition.Rule rule = context.repository("squid").rule("S0001");
    assertThat(rule.name()).isEqualTo("SOne");
    assertThat(rule.htmlDescription()).isEqualTo("S One");
  }
  @Test
  public void complete_param_description() {
    when(i18n.getParamDescription("squid", "S0001", "max")).thenReturn("Maximum");

    RulesDefinition.Context context = new RulesDefinition.Context();
    RulesDefinition.NewRepository repo = context.createRepository("squid", "java");
    repo.createRule("S0001").setName("SOne").setHtmlDescription("S One").createParam("max");

    loader.load(repo);
    repo.done();

    RulesDefinition.Rule rule = context.repository("squid").rule("S0001");
    assertThat(rule.param("max").description()).isEqualTo("Maximum");
  }