@Override
  public ClusterHealth checkCluster() {
    checkState(!nodeInformation.isStandalone(), "Clustering is not enabled");
    checkState(sharedHealthState != null, "HealthState instance can't be null when clustering is enabled");

    Set<NodeHealth> nodeHealths = sharedHealthState.readAll();
    Health health = clusterHealthChecks.stream()
      .map(clusterHealthCheck -> clusterHealthCheck.check(nodeHealths))
      .reduce(Health.GREEN, HealthReducer::merge);
    return new ClusterHealth(health, nodeHealths);
  }
@Test
  public void checkCluster_returns_NodeHealths_returned_by_HealthState() {
    when(nodeInformation.isStandalone()).thenReturn(false);
    Set<NodeHealth> nodeHealths = IntStream.range(0, 1 + random.nextInt(4)).mapToObj(i -> randomNodeHealth()).collect(Collectors.toSet());
    when(sharedHealthState.readAll()).thenReturn(nodeHealths);

    HealthCheckerImpl underTest = new HealthCheckerImpl(nodeInformation, new NodeHealthCheck[0], new ClusterHealthCheck[0], sharedHealthState);

    ClusterHealth clusterHealth = underTest.checkCluster();
    assertThat(clusterHealth.getNodes()).isEqualTo(nodeHealths);
  }