RuleParamDto maxParam = new RuleParamDto()
.setName("max")
.setType("STRING");
db.ruleDao().addRuleParam(dbSession, ruleDto, maxParam);
ActiveRuleDto activeRule = ActiveRuleDto.createFor(profileDto, ruleDto)
.setInheritance(ActiveRule.Inheritance.INHERITED.name())
.setSeverity(Severity.BLOCKER);
db.activeRuleDao().insert(dbSession, activeRule);
ActiveRuleParamDto activeRuleMinParam = ActiveRuleParamDto.createFor(minParam)
.setValue("minimum");
db.activeRuleDao().addParam(dbSession, activeRule, activeRuleMinParam);
ActiveRuleParamDto activeRuleMaxParam = ActiveRuleParamDto.createFor(maxParam)
.setValue("maximum");
db.activeRuleDao().addParam(dbSession, activeRule, activeRuleMaxParam);
dbSession.commit();
// verify db
List<ActiveRuleParamDto> persistedDtos =
db.activeRuleDao().findParamsByActiveRuleKey(dbSession, activeRule.getKey());
assertThat(persistedDtos).hasSize(2);
// verify es
ActiveRule rule = index.get(ActiveRuleIndex.class).getByKey(activeRule.getKey());
assertThat(rule).isNotNull();
assertThat(rule.params()).hasSize(2);
assertThat(rule.params().keySet()).containsOnly("min", "max");
assertThat(rule.params().values()).containsOnly("minimum", "maximum");
assertThat(rule.params().get("min")).isEqualTo("minimum");