Program: 90149
Project: 90149
Buggy source:
public void testGetBitarchiveChecksum() throws Exception {
  if (!TestUtils.runningAs("String_Node_Str")) {
    return;
  }
  AdminData.getUpdateableInstance().addEntry("String_Node_Str",null,"String_Node_Str");
  AdminData.getUpdateableInstance().addEntry("String_Node_Str",null,"String_Node_Str");
  final Map<Location,String> results=new HashMap<Location,String>();
  MockupArcRepositoryClient.instance=new MockupArcRepositoryClient(){
    public BatchStatus batch(    FileBatchJob job,    String locationName){
      if (job.getClass().equals(ChecksumJob.class)) {
        if (results.containsKey(Location.get(locationName))) {
          return new BatchStatus("String_Node_Str",Collections.<File>emptyList(),1,new StringRemoteFile(results.get(Location.get(locationName))));
        }
 else {
          return new BatchStatus("String_Node_Str",Collections.<File>emptyList(),0,null);
        }
      }
 else {
        return super.batch(job,locationName);
      }
    }
  }
;
  results.put(SB,"String_Node_Str");
  results.put(KB,"String_Node_Str");
  FilePreservationState fps=FileBasedActiveBitPreservation.getInstance().getFilePreservationState("String_Node_Str");
  assertFalse("String_Node_Str",fps.getBitarchiveChecksum(SB) == null);
  assertEquals("String_Node_Str",1,fps.getBitarchiveChecksum(SB).size());
  assertEquals("String_Node_Str","String_Node_Str",fps.getBitarchiveChecksum(SB).get(0));
  assertFalse("String_Node_Str",fps.getBitarchiveChecksum(KB) == null);
  assertEquals("String_Node_Str",1,fps.getBitarchiveChecksum(KB).size());
  assertEquals("String_Node_Str","String_Node_Str",fps.getBitarchiveChecksum(KB).get(0));
  results.clear();
  results.put(SB,"String_Node_Str");
  fps=FileBasedActiveBitPreservation.getInstance().getFilePreservationState("String_Node_Str");
  assertEquals("String_Node_Str",0,fps.getBitarchiveChecksum(SB).size());
  assertEquals("String_Node_Str",0,fps.getBitarchiveChecksum(KB).size());
  LogUtils.flushLogs(getClass().getName());
  FileAsserts.assertFileNotContains("String_Node_Str",TestInfo.LOG_FILE,"String_Node_Str");
  FileAsserts.assertFileNotContains("String_Node_Str",TestInfo.LOG_FILE,"String_Node_Str");
  results.clear();
  results.put(SB,"String_Node_Str");
  results.put(KB,"String_Node_Str");
  fps=FileBasedActiveBitPreservation.getInstance().getFilePreservationState("String_Node_Str");
  assertEquals("String_Node_Str",0,fps.getBitarchiveChecksum(SB).size());
  assertEquals("String_Node_Str",0,fps.getBitarchiveChecksum(KB).size());
  LogUtils.flushLogs(getClass().getName());
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str",TestInfo.LOG_FILE);
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str",TestInfo.LOG_FILE);
  results.clear();
  results.put(SB,"String_Node_Str");
  results.put(KB,"String_Node_Str");
  fps=FileBasedActiveBitPreservation.getInstance().getFilePreservationState("String_Node_Str");
  assertEquals("String_Node_Str",2,fps.getBitarchiveChecksum(SB).size());
  assertEquals("String_Node_Str",3,fps.getBitarchiveChecksum(KB).size());
  LogUtils.flushLogs(getClass().getName());
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str",TestInfo.LOG_FILE);
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str",TestInfo.LOG_FILE);
}

Fixed version (ground truth):
public void testGetBitarchiveChecksum() throws Exception {
  if (!TestUtils.runningAs("String_Node_Str")) {
    return;
  }
  AdminData.getUpdateableInstance().addEntry("String_Node_Str",null,"String_Node_Str");
  AdminData.getUpdateableInstance().addEntry("String_Node_Str",null,"String_Node_Str");
  final Map<Location,String> results=new HashMap<Location,String>();
  MockupArcRepositoryClient.instance=new MockupArcRepositoryClient(){
    public BatchStatus batch(    FileBatchJob job,    String locationName){
      if (job.getClass().equals(ChecksumJob.class)) {
        if (results.containsKey(Location.get(locationName))) {
          return new BatchStatus("String_Node_Str",Collections.<File>emptyList(),1,new StringRemoteFile(results.get(Location.get(locationName))));
        }
 else {
          return new BatchStatus("String_Node_Str",Collections.<File>emptyList(),0,null);
        }
      }
 else {
        return super.batch(job,locationName);
      }
    }
  }
;
  results.put(SB,"String_Node_Str");
  results.put(KB,"String_Node_Str");
  FilePreservationState fps=FileBasedActiveBitPreservation.getInstance().getFilePreservationState("String_Node_Str");
  assertFalse("String_Node_Str",fps.getBitarchiveChecksum(SB) == null);
  assertEquals("String_Node_Str",1,fps.getBitarchiveChecksum(SB).size());
  assertEquals("String_Node_Str","String_Node_Str",fps.getBitarchiveChecksum(SB).get(0));
  assertFalse("String_Node_Str",fps.getBitarchiveChecksum(KB) == null);
  assertEquals("String_Node_Str",1,fps.getBitarchiveChecksum(KB).size());
  assertEquals("String_Node_Str","String_Node_Str",fps.getBitarchiveChecksum(KB).get(0));
  results.clear();
  results.put(SB,"String_Node_Str");
  fps=FileBasedActiveBitPreservation.getInstance().getFilePreservationState("String_Node_Str");
  assertFalse("String_Node_Str",fps.getBitarchiveChecksum(SB) == null);
  assertEquals("String_Node_Str",0,fps.getBitarchiveChecksum(SB).size());
  assertEquals("String_Node_Str",0,fps.getBitarchiveChecksum(KB).size());
  LogUtils.flushLogs(getClass().getName());
  FileAsserts.assertFileNotContains("String_Node_Str",TestInfo.LOG_FILE,"String_Node_Str");
  FileAsserts.assertFileNotContains("String_Node_Str",TestInfo.LOG_FILE,"String_Node_Str");
  results.clear();
  results.put(SB,"String_Node_Str");
  results.put(KB,"String_Node_Str");
  fps=FileBasedActiveBitPreservation.getInstance().getFilePreservationState("String_Node_Str");
  assertEquals("String_Node_Str",0,fps.getBitarchiveChecksum(SB).size());
  assertEquals("String_Node_Str",0,fps.getBitarchiveChecksum(KB).size());
  LogUtils.flushLogs(getClass().getName());
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str",TestInfo.LOG_FILE);
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str",TestInfo.LOG_FILE);
  results.clear();
  results.put(SB,"String_Node_Str");
  results.put(KB,"String_Node_Str");
  fps=FileBasedActiveBitPreservation.getInstance().getFilePreservationState("String_Node_Str");
  assertEquals("String_Node_Str",2,fps.getBitarchiveChecksum(SB).size());
  assertEquals("String_Node_Str",3,fps.getBitarchiveChecksum(KB).size());
  LogUtils.flushLogs(getClass().getName());
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str",TestInfo.LOG_FILE);
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str",TestInfo.LOG_FILE);
}