Program: 4520
Project: 4520
Buggy source:
public void testHorizonStatistics(){
  HorizonCounter hc=HorizonCounter.instance();
  ManagedConnection mc=new ManagedConnection("String_Node_Str",1);
  hc.HORIZON_UPDATE_TIME=1 * 200;
  PingReply pr1=PingReply.create(GUID.makeGuid(),(byte)3,6346,new byte[]{(byte)127,(byte)0,(byte)0,(byte)1},1,10,false,0,false);
  PingReply pr2=PingReply.create(GUID.makeGuid(),(byte)3,6347,new byte[]{(byte)127,(byte)0,(byte)0,(byte)1},2,20,false,0,false);
  PingReply pr3=PingReply.create(GUID.makeGuid(),(byte)3,6346,new byte[]{(byte)127,(byte)0,(byte)0,(byte)2},3,30,false,0,false);
  assertEquals("String_Node_Str",0,hc.getNumFiles());
  assertEquals("String_Node_Str",0,hc.getNumHosts());
  assertEquals("String_Node_Str",0,hc.getTotalFileSize());
  mc.updateHorizonStats(pr1);
  mc.updateHorizonStats(pr1);
  assertEquals("String_Node_Str",1,hc.getNumFiles());
  assertEquals("String_Node_Str",1,hc.getNumHosts());
  assertEquals("String_Node_Str",10,hc.getTotalFileSize());
  try {
    Thread.sleep(HorizonCounter.HORIZON_UPDATE_TIME * 2);
  }
 catch (  InterruptedException e) {
  }
  hc.refresh();
  mc.updateHorizonStats(pr1);
  mc.updateHorizonStats(pr2);
  mc.updateHorizonStats(pr3);
  assertEquals("String_Node_Str",1,hc.getNumFiles());
  assertEquals("String_Node_Str",1,hc.getNumHosts());
  assertEquals("String_Node_Str",10,hc.getTotalFileSize());
  hc.refresh();
  assertEquals("String_Node_Str",1,hc.getNumFiles());
  assertEquals("String_Node_Str",1,hc.getNumHosts());
  assertEquals("String_Node_Str",10,hc.getTotalFileSize());
  try {
    Thread.sleep(HorizonCounter.HORIZON_UPDATE_TIME * 2);
  }
 catch (  InterruptedException e) {
  }
  hc.refresh();
  assertEquals("String_Node_Str",1 + 2 + 3,hc.getNumFiles());
  assertEquals("String_Node_Str",3,hc.getNumHosts());
  assertEquals("String_Node_Str",10 + 20 + 30,hc.getTotalFileSize());
  try {
    Thread.sleep(HorizonCounter.HORIZON_UPDATE_TIME * 2);
  }
 catch (  InterruptedException e) {
  }
  hc.refresh();
  assertEquals("String_Node_Str",0,hc.getNumFiles());
  assertEquals("String_Node_Str",0,hc.getNumHosts());
  assertEquals("String_Node_Str",0,hc.getTotalFileSize());
  mc.close();
}

Fixed version (ground truth):
public void testHorizonStatistics(){
  HorizonCounter hc=HorizonCounter.instance();
  ManagedConnection mc=new ManagedConnection("String_Node_Str",1);
  HorizonCounter.HORIZON_UPDATE_TIME=1 * 200;
  PingReply pr1=PingReply.create(GUID.makeGuid(),(byte)3,6346,new byte[]{(byte)127,(byte)0,(byte)0,(byte)1},1,10,false,0,false);
  PingReply pr2=PingReply.create(GUID.makeGuid(),(byte)3,6347,new byte[]{(byte)127,(byte)0,(byte)0,(byte)1},2,20,false,0,false);
  PingReply pr3=PingReply.create(GUID.makeGuid(),(byte)3,6346,new byte[]{(byte)127,(byte)0,(byte)0,(byte)2},3,30,false,0,false);
  assertEquals("String_Node_Str",0,hc.getNumFiles());
  assertEquals("String_Node_Str",0,hc.getNumHosts());
  assertEquals("String_Node_Str",0,hc.getTotalFileSize());
  mc.updateHorizonStats(pr1);
  mc.updateHorizonStats(pr1);
  assertEquals("String_Node_Str",1,hc.getNumFiles());
  assertEquals("String_Node_Str",1,hc.getNumHosts());
  assertEquals("String_Node_Str",10,hc.getTotalFileSize());
  try {
    Thread.sleep(HorizonCounter.HORIZON_UPDATE_TIME * 2);
  }
 catch (  InterruptedException e) {
  }
  hc.refresh();
  mc.updateHorizonStats(pr1);
  mc.updateHorizonStats(pr2);
  mc.updateHorizonStats(pr3);
  assertEquals("String_Node_Str",1,hc.getNumFiles());
  assertEquals("String_Node_Str",1,hc.getNumHosts());
  assertEquals("String_Node_Str",10,hc.getTotalFileSize());
  hc.refresh();
  assertEquals("String_Node_Str",1,hc.getNumFiles());
  assertEquals("String_Node_Str",1,hc.getNumHosts());
  assertEquals("String_Node_Str",10,hc.getTotalFileSize());
  try {
    Thread.sleep(HorizonCounter.HORIZON_UPDATE_TIME * 2);
  }
 catch (  InterruptedException e) {
  }
  hc.refresh();
  assertEquals("String_Node_Str",1 + 2 + 3,hc.getNumFiles());
  assertEquals("String_Node_Str",3,hc.getNumHosts());
  assertEquals("String_Node_Str",10 + 20 + 30,hc.getTotalFileSize());
  try {
    Thread.sleep(HorizonCounter.HORIZON_UPDATE_TIME * 2);
  }
 catch (  InterruptedException e) {
  }
  hc.refresh();
  assertEquals("String_Node_Str",0,hc.getNumFiles());
  assertEquals("String_Node_Str",0,hc.getNumHosts());
  assertEquals("String_Node_Str",0,hc.getTotalFileSize());
  mc.close();
}