@Override public Set<String> getMetricsRelatedTo(QualityGate gate) { Set<String> metricKeys = new HashSet<>(); metricKeys.add(CoreMetrics.ALERT_STATUS_KEY); metricKeys.add(CoreMetrics.QUALITY_GATE_DETAILS_KEY); metricKeys.addAll(evaluator.getMetricKeys(gate)); return metricKeys; }
@Test public void getMetricKeys_includes_metrics_from_qgate() { Set<String> metricKeys = ImmutableSet.of("foo", "bar", "baz"); Set<Condition> conditions = metricKeys.stream().map(key -> { Condition condition = mock(Condition.class); when(condition.getMetricKey()).thenReturn(key); return condition; }).collect(Collectors.toSet()); QualityGate gate = mock(QualityGate.class); when(gate.getConditions()).thenReturn(conditions); assertThat(underTest.getMetricKeys(gate)).containsAll(metricKeys); }
@Test public void getMetricKeys_includes_by_default_new_lines() { QualityGate gate = mock(QualityGate.class); assertThat(underTest.getMetricKeys(gate)).containsExactly(NEW_LINES_KEY); }
@Override public Set<String> getMetricsRelatedTo(QualityGate gate) { Set<String> metricKeys = new HashSet<>(); metricKeys.add(CoreMetrics.ALERT_STATUS_KEY); metricKeys.add(CoreMetrics.QUALITY_GATE_DETAILS_KEY); metricKeys.addAll(evaluator.getMetricKeys(gate)); return metricKeys; }