@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_copies_value() {
    Condition otherCondition = new Condition(newMetric(METRIC_KEY), Condition.Operator.LESS_THAN.getDbValue(), ERROR_THRESHOLD);
    ConditionToCondition underTest = new ConditionToCondition(of(
      SOME_CONDITION, SOME_CONDITION_STATUS,
      otherCondition, ConditionStatus.NO_VALUE_STATUS));

    assertThat(underTest.apply(SOME_CONDITION).getValue()).isEqualTo(SOME_VALUE);

    QualityGate.Condition res = underTest.apply(otherCondition);

    assertThatThrownBy(res::getValue)
      .isInstanceOf(IllegalStateException.class)
      .hasMessage("There is no value when status is NO_VALUE");
  }