@Test
  public void test_changeLocalClusterState_success() throws Exception {
    final ClusterState newState = FROZEN;
    final Address initiator = newAddress();
    clusterStateManager.lockClusterState(newState, initiator, TXN, 10000, 0);
    clusterStateManager.commitClusterState(newState, initiator, TXN);

    assertEquals(newState, clusterStateManager.getState());
    final ClusterStateLock stateLock = clusterStateManager.getStateLock();
    assertFalse(stateLock.isLocked());
  }
  @Test
  public void changeLocalClusterState_shouldChangeNodeStateToShuttingDown_whenStateBecomes_PASSIVE()
      throws Exception {
    final ClusterState newState = PASSIVE;
    final Address initiator = newAddress();
    clusterStateManager.lockClusterState(newState, initiator, TXN, 10000, 0);
    clusterStateManager.commitClusterState(newState, initiator, TXN);

    assertEquals(newState, clusterStateManager.getState());
    verify(node, times(1)).changeNodeStateToPassive();
  }
  @Test
  public void changeLocalClusterState_shouldRemoveMembersDeadWhileFrozen_whenStateBecomes_ACTIVE()
      throws Exception {
    final ClusterState newState = ACTIVE;
    final Address initiator = newAddress();
    clusterStateManager.initialClusterState(FROZEN);
    clusterStateManager.lockClusterState(newState, initiator, TXN, 10000, 0);
    clusterStateManager.commitClusterState(newState, initiator, TXN);

    assertEquals(newState, clusterStateManager.getState());
    verify(clusterService, times(1)).removeMembersDeadWhileClusterIsNotActive();
  }
 @Test(expected = TransactionException.class)
 public void test_changeLocalClusterState_fail_whenLockedByElse() throws Exception {
   final Address initiator = newAddress();
   clusterStateManager.lockClusterState(FROZEN, initiator, TXN, 10000, 0);
   clusterStateManager.commitClusterState(FROZEN, initiator, ANOTHER_TXN);
 }
 @Test(expected = TransactionException.class)
 public void test_changeLocalClusterState_fail_notLocked() throws Exception {
   clusterStateManager.commitClusterState(FROZEN, newAddress(), TXN);
 }
 @Test(expected = NullPointerException.class)
 public void test_changeLocalClusterState_nullTransactionId() throws Exception {
   clusterStateManager.commitClusterState(FROZEN, newAddress(), null);
 }
 @Test(expected = IllegalArgumentException.class)
 public void test_changeLocalClusterState_IN_TRANSITION() throws Exception {
   clusterStateManager.commitClusterState(IN_TRANSITION, newAddress(), TXN);
 }
 @Test(expected = NullPointerException.class)
 public void test_changeLocalClusterState_nullState() throws Exception {
   clusterStateManager.commitClusterState(null, newAddress(), TXN);
 }