when(qProfileFactory.getByProjectAndLanguage(session, projectKey, "java")).thenReturn(
QualityProfileDto.createFor("abcd").setName("Default").setLanguage("java").setRulesUpdatedAt("2014-01-14T14:00:00+0200")
);
RuleKey ruleKey = RuleKey.of("squid", "AvoidCycle");
ActiveRule activeRule = mock(ActiveRule.class);
when(activeRule.key()).thenReturn(ActiveRuleKey.of("abcd", ruleKey));
when(activeRule.severity()).thenReturn(Severity.MINOR);
when(activeRule.params()).thenReturn(ImmutableMap.of("max", "2"));
when(qProfileLoader.findActiveRulesByProfile("abcd")).thenReturn(newArrayList(activeRule));
Rule rule = mock(Rule.class);
when(rule.name()).thenReturn("Avoid Cycle");
when(rule.internalKey()).thenReturn("squid-1");