Program: 90163
Project: 90163
Buggy source:
/** 
 * Tests the writeHarvestFiles method.
 * @throws Exception
 */
public void testWriteHarvestFiles() throws Exception {
  Job j=TestInfo.getJob();
  j.setJobID(1L);
  assertTrue("String_Node_Str",j.getSeedListAsString() != "String_Node_Str");
  assertTrue("String_Node_Str",j.getOrderXMLdoc().hasContent());
  File crawlDir=new File(TestInfo.WORKING_DIR,"String_Node_Str");
  FileUtils.createDir(crawlDir);
  List<MetadataEntry> metadata=Arrays.asList(new MetadataEntry[]{TestInfo.sampleEntry});
  File harvestInfo=new File(crawlDir,"String_Node_Str");
  File seedsTxt=new File(crawlDir,"String_Node_Str");
  File orderXml=new File(crawlDir,"String_Node_Str");
  File metadataFile=new File(crawlDir,j.getJobID() + "String_Node_Str");
  assertFalse("String_Node_Str",metadataFile.exists());
  assertFalse("String_Node_Str",harvestInfo.exists());
  assertFalse("String_Node_Str",seedsTxt.exists());
  assertFalse("String_Node_Str",orderXml.exists());
  HarvestController controller=HarvestController.getInstance();
  HeritrixFiles files=controller.writeHarvestFiles(crawlDir,j,metadata);
  assertTrue("String_Node_Str",harvestInfo.exists());
  assertTrue("String_Node_Str",seedsTxt.exists());
  assertTrue("String_Node_Str",orderXml.exists());
  assertTrue("String_Node_Str",metadataFile.exists());
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str" + j.getJobID() + "String_Node_Str",harvestInfo);
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str" + j.getOrigHarvestDefinitionID() + "String_Node_Str",harvestInfo);
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str",orderXml);
  Document order=XmlUtils.getXmlDoc(orderXml);
  HeritrixTemplate template=new HeritrixTemplate(order,true);
  FileAsserts.assertFileContains("String_Node_Str",j.getSeedListAsString(),seedsTxt);
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str",metadataFile);
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str",metadataFile);
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str",metadataFile);
  assertEquals("String_Node_Str",crawlDir,files.getCrawlDir());
  assertEquals("String_Node_Str",orderXml,files.getOrderXmlFile());
  assertEquals("String_Node_Str",seedsTxt,files.getSeedsTxtFile());
  assertTrue("String_Node_Str",files.getIndexDir().isDirectory());
  assertEquals("String_Node_Str",3,files.getIndexDir().listFiles().length);
}

Fixed version (ground truth):
/** 
 * Tests the writeHarvestFiles method.
 * @throws Exception
 */
public void testWriteHarvestFiles() throws Exception {
  Job j=TestInfo.getJob();
  j.setJobID(1L);
  assertTrue("String_Node_Str",j.getSeedListAsString() != "String_Node_Str");
  assertTrue("String_Node_Str",j.getOrderXMLdoc().hasContent());
  File crawlDir=new File(TestInfo.WORKING_DIR,"String_Node_Str");
  FileUtils.createDir(crawlDir);
  List<MetadataEntry> metadata=Arrays.asList(new MetadataEntry[]{TestInfo.sampleEntry});
  File harvestInfo=new File(crawlDir,"String_Node_Str");
  File seedsTxt=new File(crawlDir,"String_Node_Str");
  File orderXml=new File(crawlDir,"String_Node_Str");
  File metadataFile=new File(crawlDir,j.getJobID() + "String_Node_Str");
  assertFalse("String_Node_Str",metadataFile.exists());
  assertFalse("String_Node_Str",harvestInfo.exists());
  assertFalse("String_Node_Str",seedsTxt.exists());
  assertFalse("String_Node_Str",orderXml.exists());
  HarvestController controller=HarvestController.getInstance();
  HeritrixFiles files=controller.writeHarvestFiles(crawlDir,j,metadata);
  assertTrue("String_Node_Str",harvestInfo.exists());
  assertTrue("String_Node_Str",seedsTxt.exists());
  assertTrue("String_Node_Str",orderXml.exists());
  assertTrue("String_Node_Str",metadataFile.exists());
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str" + j.getJobID() + "String_Node_Str",harvestInfo);
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str" + j.getOrigHarvestDefinitionID() + "String_Node_Str",harvestInfo);
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str",orderXml);
  new HeritrixTemplate(XmlUtils.getXmlDoc(orderXml),true);
  FileAsserts.assertFileContains("String_Node_Str",j.getSeedListAsString(),seedsTxt);
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str",metadataFile);
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str",metadataFile);
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str",metadataFile);
  assertEquals("String_Node_Str",crawlDir,files.getCrawlDir());
  assertEquals("String_Node_Str",orderXml,files.getOrderXmlFile());
  assertEquals("String_Node_Str",seedsTxt,files.getSeedsTxtFile());
  assertTrue("String_Node_Str",files.getIndexDir().isDirectory());
  assertEquals("String_Node_Str",3,files.getIndexDir().listFiles().length);
  assertTrue("String_Node_Str",files.getArcsDir().isDirectory());
}