@Test
public void show_rule() throws Exception {
QualityProfileDto profile = QProfileTesting.newXooP1();
tester.get(QualityProfileDao.class).insert(session, profile);
RuleDto rule = RuleTesting.newXooX1();
ruleDao.insert(session, rule);
ActiveRuleDto activeRuleDto = ActiveRuleDto.createFor(profile, rule).setSeverity("BLOCKER");
tester.get(ActiveRuleDao.class).insert(session, activeRuleDto);
session.commit();
session.clearCache();
MockUserSession.set();
// 1. With Activation
WsTester.TestRequest request = tester.wsTester().newGetRequest(API_ENDPOINT, API_SHOW_METHOD);
request.setParam(ShowAction.PARAM_KEY, rule.getKey().toString());
request.setParam(ShowAction.PARAM_ACTIVES, "true");
WsTester.Result result = request.execute();
result.assertJson(this.getClass(), "show_rule_active.json", false);
// 1. Default Activation (defaults to false)
request = tester.wsTester().newGetRequest(API_ENDPOINT, API_SHOW_METHOD);
request.setParam(ShowAction.PARAM_KEY, rule.getKey().toString());
result = request.execute();
result.assertJson(this.getClass(), "show_rule_no_active.json", false);
}