@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_passes_set_of_NodeHealth_returns_by_HealthState_to_all_ClusterHealthChecks() {
    when(nodeInformation.isStandalone()).thenReturn(false);
    ClusterHealthCheck[] mockedClusterHealthChecks = IntStream.range(0, 1 + random.nextInt(3))
      .mapToObj(i -> mock(ClusterHealthCheck.class))
      .toArray(ClusterHealthCheck[]::new);
    Set<NodeHealth> nodeHealths = IntStream.range(0, 1 + random.nextInt(4)).mapToObj(i -> randomNodeHealth()).collect(Collectors.toSet());
    when(sharedHealthState.readAll()).thenReturn(nodeHealths);
    for (ClusterHealthCheck mockedClusterHealthCheck : mockedClusterHealthChecks) {
      when(mockedClusterHealthCheck.check(same(nodeHealths))).thenReturn(Health.GREEN);
    }

    HealthCheckerImpl underTest = new HealthCheckerImpl(nodeInformation, new NodeHealthCheck[0], mockedClusterHealthChecks, sharedHealthState);
    underTest.checkCluster();

    for (ClusterHealthCheck mockedClusterHealthCheck : mockedClusterHealthChecks) {
      verify(mockedClusterHealthCheck).check(same(nodeHealths));
    }
  }