}
String key = profile.key();
+ Long activeRuleCount = activeRuleCountByKey.containsKey(key) ? activeRuleCountByKey.get(key) : 0L;
json.beginObject()
.prop(FIELD_KEY, nullUnlessNeeded(FIELD_KEY, key, fields))
.prop(FIELD_NAME, nullUnlessNeeded(FIELD_NAME, profile.name(), fields))
- .prop(FIELD_ACTIVE_RULE_COUNT, nullUnlessNeeded(FIELD_ACTIVE_RULE_COUNT, activeRuleCountByKey.get(key), fields));
+ .prop(FIELD_ACTIVE_RULE_COUNT, nullUnlessNeeded(FIELD_ACTIVE_RULE_COUNT, activeRuleCount, fields));
writeLanguageFields(json, profile, fields);
writeParentFields(json, profile, fields, profilesByKey);
// Special case for booleans
public void search_nominal() throws Exception {
when(profileLoader.countAllActiveRules()).thenReturn(ImmutableMap.of(
"sonar-way-xoo1-12345", 11L,
- "sonar-way-xoo2-23456", 22L,
"my-sonar-way-xoo2-34567", 33L
));