@Override
  public Health check(Set<NodeHealth> nodeHealths) {
    ClusterHealthResponse esClusterHealth = this.getEsClusterHealth();
    if (esClusterHealth != null) {
      Health minimumNodes = checkMinimumNodes(esClusterHealth);
      Health clusterStatus = extractStatusHealth(esClusterHealth);
      return HealthReducer.merge(minimumNodes, clusterStatus);
    }
    return RED_HEALTH_UNAVAILABLE;
  }
@Test
  public void check_ignores_NodeHealth_arg_and_returns_RED_with_cause_if_an_exception_occurs_checking_ES_cluster_status() {
    Set<NodeHealth> nodeHealths = ImmutableSet.of(newNodeHealth(NodeHealth.Status.GREEN));
    when(esClient.clusterHealth(any())).thenThrow(new RuntimeException("Faking an exception occurring while using the EsClient"));

    Health health = new EsStatusClusterCheck(esClient).check(nodeHealths);

    assertThat(health.getStatus()).isEqualTo(Health.Status.RED);
    assertThat(health.getCauses()).containsOnly("Elasticsearch status is RED (unavailable)");
  }