@Override
  public QualityGate.Condition apply(Condition input) {
    String metricKey = input.getMetric().getKey();
    ConditionStatus conditionStatus = statusPerConditions.get(input);
    checkState(conditionStatus != null, "Missing ConditionStatus for condition on metric key %s", metricKey);
    return builder
      .setStatus(convert(conditionStatus.getStatus()))
      .setMetricKey(metricKey)
      .setOperator(convert(input.getOperator()))
      .setErrorThreshold(input.getErrorThreshold())
      .setValue(conditionStatus.getValue())
      .build();
  }
@Test
  public void apply_throws_ISE_if_there_is_no_ConditionStatus_for_Condition_argument() {
    ConditionToCondition underTest = new ConditionToCondition(NO_STATUS_PER_CONDITIONS);

    assertThatThrownBy(() -> underTest.apply(SOME_CONDITION))
      .isInstanceOf(IllegalStateException.class)
      .hasMessage("Missing ConditionStatus for condition on metric key " + METRIC_KEY);
  }