public ProjectStatusResponse.ProjectStatus format() {
    if (!optionalMeasureData.isPresent()) {
      return newResponseWithoutQualityGateDetails();
    }

    JsonObject json = JsonParser.parseString(optionalMeasureData.get()).getAsJsonObject();

    ProjectStatusResponse.Status qualityGateStatus = measureLevelToQualityGateStatus(json.get("level").getAsString());
    projectStatusBuilder.setStatus(qualityGateStatus);
    projectStatusBuilder.setCaycStatus(caycStatus.toString());

    formatIgnoredConditions(json);
    formatConditions(json.getAsJsonArray("conditions"));
    formatPeriods();

    return projectStatusBuilder.build();
  }
@Test
  public void fail_when_measure_op_is_unknown() {
    String measureData = "{\n" +
      "  \"level\": \"ERROR\",\n" +
      "  \"conditions\": [\n" +
      "    {\n" +
      "      \"metric\": \"new_coverage\",\n" +
      "      \"op\": \"UNKNOWN\",\n" +
      "      \"period\": 1,\n" +
      "      \"warning\": \"80\",\n" +
      "      \"error\": \"85\",\n" +
      "      \"actual\": \"82.2985024398452\",\n" +
      "      \"level\": \"ERROR\"\n" +
      "    }\n" +
      "  ]\n" +
      "}";
    underTest = newQualityGateDetailsFormatter(measureData, new SnapshotDto());

    assertThatThrownBy(() -> underTest.format())
      .isInstanceOf(IllegalStateException.class)
      .hasMessageContaining("Unknown quality gate comparator 'UNKNOWN'");
  }