public void onChange(Multimap<QProfileName, ActiveRuleChange> changedProfiles, long startDate, long endDate) {
    if (config.getBoolean(DISABLE_NOTIFICATION_ON_BUILT_IN_QPROFILES).orElse(false)) {
      return;
    }

    BuiltInQPChangeNotificationBuilder builder = new BuiltInQPChangeNotificationBuilder();
    changedProfiles.keySet().stream()
      .map(changedProfile -> {
        String profileName = changedProfile.getName();
        Language language = languages.get(changedProfile.getLanguage());
        Collection<ActiveRuleChange> activeRuleChanges = changedProfiles.get(changedProfile);
        int newRules = (int) activeRuleChanges.stream().map(ActiveRuleChange::getType).filter(ACTIVATED::equals).count();
        int updatedRules = (int) activeRuleChanges.stream().map(ActiveRuleChange::getType).filter(UPDATED::equals).count();
        int removedRules = (int) activeRuleChanges.stream().map(ActiveRuleChange::getType).filter(DEACTIVATED::equals).count();
        return Profile.newBuilder()
          .setProfileName(profileName)
          .setLanguageKey(language.getKey())
          .setLanguageName(language.getName())
          .setNewRules(newRules)
          .setUpdatedRules(updatedRules)
          .setRemovedRules(removedRules)
          .setStartDate(startDate)
          .setEndDate(endDate)
          .build();
      })
      .forEach(builder::addProfile);

    notificationManager.scheduleForSending(builder.build());
  }
@Test
  public void avoid_notification_if_configured_in_settings() {
    settings.setProperty(DISABLE_NOTIFICATION_ON_BUILT_IN_QPROFILES, true);
    Multimap<QProfileName, ActiveRuleChange> profiles = ArrayListMultimap.create();
    Languages languages = new Languages();
    addProfile(profiles, languages, ACTIVATED);

    BuiltInQualityProfilesUpdateListener underTest = new BuiltInQualityProfilesUpdateListener(notificationManager, languages, settings.asConfig());
    underTest.onChange(profiles, 0, 1);

    verifyNoInteractions(notificationManager);
  }