@Override
  public Health check(Set<NodeHealth> nodeHealths) {
    Set<NodeHealth> appNodes = nodeHealths.stream()
      .filter(s -> s.getDetails().getType() == NodeDetails.Type.APPLICATION)
      .collect(Collectors.toSet());

    return Arrays.stream(AppNodeClusterHealthSubChecks.values())
      .map(s -> s.check(appNodes))
      .reduce(Health.GREEN, HealthReducer::merge);
  }
@Test
  public void status_YELLOW_when_two_GREEN_application_node_and_any_number_of_other_is_RED_or_GREEN() {
    Set<NodeHealth> nodeHealths = of(
      // at least 1 RED
      of(appNodeHealth(RED)),
      // 0 to 10 RED/GREEN
      randomNumberOfAppNodeHealthOfAnyStatus(GREEN, RED),
      // 2 GREEN
      nodeHealths(GREEN, GREEN))
      .flatMap(s -> s)
      .collect(toSet());
    Health check = underTest.check(nodeHealths);

    assertThat(check)
      .forInput(nodeHealths)
      .hasStatus(Health.Status.YELLOW)
      .andCauses("At least one application node is RED");
  }