public ClusterStatus appendNewState(ClusterState state) {
    return new ClusterStatus(
        state,
        createUpdatedHistoryWithNewState(state),
        previousAttemptSummary,
        currentAttemptSummary);
  }
@Test
  void testAppendNewState() {
    ClusterStatus status = new ClusterStatus();
    ClusterState newState = new ClusterState(ClusterStateSummary.RunningHealthy, "foo");
    ClusterStatus newStatus = status.appendNewState(newState);
    assertEquals(2, newStatus.getStateTransitionHistory().size());
    assertEquals(newState, newStatus.getStateTransitionHistory().get(1L));
  }