}
@Test
public void insert_update_debt_overload() throws Exception {
RuleDto ruleDto = RuleTesting.newXooX1()
.setRemediationFunction(null)
.setRemediationCoefficient(null)
.setRemediationOffset(null);
RuleDto overloadedRuleDto = RuleTesting.newXooX2();
dao.insert(dbSession, ruleDto, overloadedRuleDto);
dbSession.commit();
// Assert is overloaded or not
assertThat(index.getByKey(RuleTesting.XOO_X1).debtOverloaded()).isFalse();
assertThat(index.getByKey(RuleTesting.XOO_X2).debtOverloaded()).isTrue();
// Assert overloaded value
Rule base = index.getByKey(RuleTesting.XOO_X1);
Rule overloaded = index.getByKey(RuleTesting.XOO_X2);
assertThat(base.debtRemediationFunction().type().toString())
.isEqualTo(ruleDto.getDefaultRemediationFunction());
assertThat(base.debtRemediationFunction().coefficient())
.isEqualTo(ruleDto.getDefaultRemediationCoefficient());
assertThat(base.debtRemediationFunction().offset())
.isEqualTo(ruleDto.getDefaultRemediationOffset());
assertThat(overloaded.debtRemediationFunction().type().toString())
.isEqualTo(overloadedRuleDto.getRemediationFunction());
assertThat(overloaded.debtRemediationFunction().coefficient())
.isEqualTo(overloadedRuleDto.getRemediationCoefficient());
assertThat(overloaded.debtRemediationFunction().offset())
.isEqualTo(overloadedRuleDto.getRemediationOffset());
}