}
@Test
public void insert_and_index_rule_parameters() {
// insert db
RuleDto ruleDto = RuleTesting.newXooX1();
dao.insert(dbSession, ruleDto);
dbSession.commit();
RuleParamDto minParamDto = new RuleParamDto()
.setName("min")
.setType(RuleParamType.INTEGER.type())
.setDefaultValue("2")
.setDescription("Minimum");
dao.addRuleParam(dbSession, ruleDto, minParamDto);
RuleParamDto maxParamDto = new RuleParamDto()
.setName("max")
.setType(RuleParamType.INTEGER.type())
.setDefaultValue("10")
.setDescription("Maximum");
dao.addRuleParam(dbSession, ruleDto, maxParamDto);
dbSession.commit();
//Verify that RuleDto has date from insertion
RuleDto theRule = dao.getNullableByKey(dbSession, RuleTesting.XOO_X1);
assertThat(theRule.getCreatedAt()).isNotNull();
assertThat(theRule.getUpdatedAt()).isNotNull();
// verify that parameters are persisted in db
List<RuleParamDto> persistedDtos = dao.findRuleParamsByRuleKey(dbSession, theRule.getKey());
assertThat(persistedDtos).hasSize(2);
// verify that parameters are indexed in es
Rule hit = index.getByKey(RuleTesting.XOO_X1);