// Create custom rule
RuleDto customRule = RuleTesting.newCustomRule(templateRule).setLanguage("xoo");
dao.insert(dbSession, customRule);
// Create a quality profile
QualityProfileDto profileDto = QProfileTesting.newXooP1();
db.qualityProfileDao().insert(dbSession, profileDto);
dbSession.commit();
dbSession.clearCache();
// Activate the custom rule
activate(new RuleActivation(customRule.getKey()).setSeverity(Severity.BLOCKER), QProfileTesting.XOO_P1_KEY);
// Delete custom rule
deleter.delete(customRule.getKey());
// Verify custom rule have status REMOVED
Rule customRuleReloaded = index.getByKey(customRule.getKey());
assertThat(customRuleReloaded).isNotNull();
assertThat(customRuleReloaded.status()).isEqualTo(RuleStatus.REMOVED);
// Verify there's no more active rule from custom rule
List<ActiveRule> activeRules = tester.get(ActiveRuleIndex.class).findByProfile(profileDto.getKey());
assertThat(activeRules).isEmpty();
}