@Test
  public void controlReplicationFailureTest() throws InterruptedException, IOException {
    replicationManager.reset();
    replicationManager.controlReplicationReturnVal = false;
    sendAndVerifyReplicationControlRequest(Collections.emptyList(), false,
        clusterMap.getWritablePartitionIds(DEFAULT_PARTITION_CLASS).get(0), ServerErrorCode.BadRequest);
    replicationManager.reset();
    replicationManager.exceptionToThrow = new IllegalStateException();
    sendAndVerifyReplicationControlRequest(Collections.emptyList(), false,
        clusterMap.getWritablePartitionIds(DEFAULT_PARTITION_CLASS).get(0), ServerErrorCode.UnknownError);
    // PartitionUnknown is hard to simulate without betraying knowledge of the internals of MockClusterMap.
  }
Tests that {@link AdminRequestOrResponseType#ReplicationControl} fails when bad input is provided (or when there is
bad internal state).
ambry-server/src/test/java/com/github/ambry/server/AmbryServerRequestsTest.java