@Override
  public boolean validate(String metricKey) {
    Metric metric = metricByKey.get(metricKey);
    if (metric == null) {
      if (!alreadyLoggedMetricKeys.contains(metricKey)) {
        LOG.debug("The metric '{}' is ignored and should not be send in the batch report", metricKey);
        alreadyLoggedMetricKeys.add(metricKey);
      }
      return false;
    }
    return true;
  }
@Test
  public void not_generate_new_log_when_validating_twice_the_same_metric() {
    when(scannerMetrics.getMetrics()).thenReturn(Collections.emptySet());
    ReportMetricValidator validator = new ReportMetricValidatorImpl(scannerMetrics);

    assertThat(validator.validate(METRIC_KEY)).isFalse();
    assertThat(logTester.logs()).filteredOn(expectedLog::equals).hasSize(1);
    assertThat(validator.validate(METRIC_KEY)).isFalse();
    assertThat(logTester.logs()).filteredOn(expectedLog::equals).hasSize(1);
  }