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 ignore_period_not_set_on_leak_period() throws IOException {
    String measureData = IOUtils.toString(getClass().getResource("QualityGateDetailsFormatterTest/non_leak_period.json"));
    SnapshotDto snapshot = new SnapshotDto()
      .setPeriodMode("last_version")
      .setPeriodParam("2015-12-07")
      .setPeriodDate(1449404331764L);
    underTest = newQualityGateDetailsFormatter(measureData, snapshot);

    ProjectStatus result = underTest.format();

    // check conditions
    assertThat(result.getConditionsCount()).isOne();
    List<ProjectStatusResponse.Condition> conditions = result.getConditionsList();
    assertThat(conditions).extracting("status").containsExactly(ProjectStatusResponse.Status.ERROR);
    assertThat(conditions).extracting("metricKey").containsExactly("new_coverage");
    assertThat(conditions).extracting("comparator").containsExactly(ProjectStatusResponse.Comparator.LT);
    assertThat(conditions).extracting("errorThreshold").containsOnly("85");
    assertThat(conditions).extracting("actualValue").containsExactly("82.2985024398452");
  }