Program: 61070
Project: 61070
Buggy source:
@Test(timeout=180000) public void testRegionAvailabilityWithRegionMoves() throws Exception {
  List<HRegionInfo> list0=new ArrayList<HRegionInfo>();
  List<HRegionInfo> list1=new ArrayList<HRegionInfo>();
  List<HRegionInfo> list2=new ArrayList<HRegionInfo>();
  HRegionInfo hri1=new HRegionInfo(TableName.valueOf(name.getMethodName()),"String_Node_Str".getBytes(),"String_Node_Str".getBytes(),false,100);
  HRegionInfo hri2=RegionReplicaUtil.getRegionInfoForReplica(hri1,1);
  HRegionInfo hri3=new HRegionInfo(TableName.valueOf(name.getMethodName()),"String_Node_Str".getBytes(),"String_Node_Str".getBytes(),false,101);
  list0.add(hri1);
  list1.add(hri2);
  list2.add(hri3);
  Map<ServerName,List<HRegionInfo>> clusterState=new LinkedHashMap<ServerName,List<HRegionInfo>>();
  clusterState.put(servers[0],list0);
  clusterState.put(servers[1],list1);
  clusterState.put(servers[2],list2);
  Cluster cluster=new Cluster(clusterState,null,null,rackManager);
  assertTrue(!cluster.wouldLowerAvailability(hri1,servers[2]));
  cluster.doAction(new MoveRegionAction(0,0,2));
  assertTrue(cluster.wouldLowerAvailability(hri1,servers[2]));
  clusterState.clear();
  List<HRegionInfo> list3=new ArrayList<HRegionInfo>();
  HRegionInfo hri4=RegionReplicaUtil.getRegionInfoForReplica(hri3,1);
  list3.add(hri4);
  clusterState.put(servers[0],list0);
  clusterState.put(servers[5],list1);
  clusterState.put(servers[6],list2);
  clusterState.put(servers[12],list3);
  cluster=new Cluster(clusterState,null,null,rackManager);
  assertTrue(!cluster.wouldLowerAvailability(hri4,servers[0]));
  cluster.doAction(new MoveRegionAction(2,2,0));
  assertTrue(cluster.wouldLowerAvailability(hri3,servers[0]));
}

Fixed version (ground truth):
@Test(timeout=180000) public void testRegionAvailabilityWithRegionMoves() throws Exception {
  List<HRegionInfo> list0=new ArrayList<HRegionInfo>();
  List<HRegionInfo> list1=new ArrayList<HRegionInfo>();
  List<HRegionInfo> list2=new ArrayList<HRegionInfo>();
  HRegionInfo hri1=new HRegionInfo(TableName.valueOf(name.getMethodName()),"String_Node_Str".getBytes(),"String_Node_Str".getBytes(),false,100);
  HRegionInfo hri2=RegionReplicaUtil.getRegionInfoForReplica(hri1,1);
  HRegionInfo hri3=new HRegionInfo(TableName.valueOf(name.getMethodName()),"String_Node_Str".getBytes(),"String_Node_Str".getBytes(),false,101);
  list0.add(hri1);
  list1.add(hri2);
  list2.add(hri3);
  Map<ServerName,List<HRegionInfo>> clusterState=new LinkedHashMap<ServerName,List<HRegionInfo>>();
  clusterState.put(servers[0],list0);
  clusterState.put(servers[1],list1);
  clusterState.put(servers[2],list2);
  Cluster cluster=new Cluster(clusterState,null,null,rackManager);
  assertTrue(!cluster.wouldLowerAvailability(hri1,servers[2]));
  cluster.doAction(new MoveRegionAction(0,0,2));
  assertEquals(2,cluster.numMaxRegionsPerTable[0]);
  assertTrue(cluster.wouldLowerAvailability(hri1,servers[2]));
  clusterState.clear();
  List<HRegionInfo> list3=new ArrayList<HRegionInfo>();
  HRegionInfo hri4=RegionReplicaUtil.getRegionInfoForReplica(hri3,1);
  list3.add(hri4);
  clusterState.put(servers[0],list0);
  clusterState.put(servers[5],list1);
  clusterState.put(servers[6],list2);
  clusterState.put(servers[12],list3);
  cluster=new Cluster(clusterState,null,null,rackManager);
  assertTrue(!cluster.wouldLowerAvailability(hri4,servers[0]));
  cluster.doAction(new MoveRegionAction(2,2,0));
  assertTrue(cluster.wouldLowerAvailability(hri3,servers[0]));
}