Program: 69828
Project: 69828
Buggy source:
@Test public void testImport_OpenOLATTest_processAttachments_mattext() throws IOException, URISyntaxException {
  URL itemUrl=QTIImportProcessorTest.class.getResource("String_Node_Str");
  Assert.assertNotNull(itemUrl);
  File itemFile=new File(itemUrl.toURI());
  QTIImportProcessor proc=new QTIImportProcessor(owner,itemFile.getName(),itemFile,questionItemDao,qItemTypeDao,qEduContextDao,qpoolFileStorage);
  List<QuestionItem> items=proc.process();
  Assert.assertNotNull(items);
  Assert.assertEquals(2,items.size());
  dbInstance.commitAndCloseSession();
  for (  QuestionItem item : items) {
    QuestionItemFull itemFull=(QuestionItemFull)item;
    String dir=itemFull.getDirectory();
    String file=itemFull.getRootFilename();
    VFSContainer itemContainer=qpoolFileStorage.getContainer(dir);
    Assert.assertNotNull(itemContainer);
    VFSItem itemLeaf=itemContainer.resolve(file);
    Assert.assertNotNull(itemLeaf);
    Assert.assertTrue(itemLeaf instanceof VFSLeaf);
    InputStream is=((VFSLeaf)itemLeaf).getInputStream();
    XMLParser xmlParser=new XMLParser(new IMSEntityResolver());
    Document doc=xmlParser.parse(is,false);
    Node itemNode=doc.selectSingleNode("String_Node_Str");
    Assert.assertNotNull(itemNode);
    if (itemFull.getType().getType().equals(QuestionType.SC.name())) {
      Assert.assertTrue(exists(itemFull,"String_Node_Str"));
      Assert.assertTrue(exists(itemFull,"String_Node_Str"));
      Assert.assertFalse(exists(itemFull,"String_Node_Str"));
    }
 else     if (itemFull.getType().getType().equals(QuestionType.MC.name())) {
      Assert.assertFalse(exists(itemFull,"String_Node_Str"));
      Assert.assertTrue(exists(itemFull,"String_Node_Str"));
      Assert.assertTrue(exists(itemFull,"String_Node_Str"));
    }
 else {
      Assert.fail();
    }
  }
}

Fixed version (ground truth):
@Test public void testImport_OpenOLATTest_processAttachments_mattext() throws IOException, URISyntaxException {
  URL itemUrl=QTIImportProcessorTest.class.getResource("String_Node_Str");
  Assert.assertNotNull(itemUrl);
  File itemFile=new File(itemUrl.toURI());
  QTIImportProcessor proc=new QTIImportProcessor(owner,Locale.ENGLISH,itemFile.getName(),itemFile,questionItemDao,qItemTypeDao,qEduContextDao,qpoolFileStorage);
  List<QuestionItem> items=proc.process();
  Assert.assertNotNull(items);
  Assert.assertEquals(2,items.size());
  dbInstance.commitAndCloseSession();
  for (  QuestionItem item : items) {
    QuestionItemFull itemFull=(QuestionItemFull)item;
    String dir=itemFull.getDirectory();
    String file=itemFull.getRootFilename();
    VFSContainer itemContainer=qpoolFileStorage.getContainer(dir);
    Assert.assertNotNull(itemContainer);
    VFSItem itemLeaf=itemContainer.resolve(file);
    Assert.assertNotNull(itemLeaf);
    Assert.assertTrue(itemLeaf instanceof VFSLeaf);
    InputStream is=((VFSLeaf)itemLeaf).getInputStream();
    XMLParser xmlParser=new XMLParser(new IMSEntityResolver());
    Document doc=xmlParser.parse(is,false);
    Node itemNode=doc.selectSingleNode("String_Node_Str");
    Assert.assertNotNull(itemNode);
    if (itemFull.getType().getType().equals(QuestionType.SC.name())) {
      Assert.assertTrue(exists(itemFull,"String_Node_Str"));
      Assert.assertTrue(exists(itemFull,"String_Node_Str"));
      Assert.assertFalse(exists(itemFull,"String_Node_Str"));
    }
 else     if (itemFull.getType().getType().equals(QuestionType.MC.name())) {
      Assert.assertFalse(exists(itemFull,"String_Node_Str"));
      Assert.assertTrue(exists(itemFull,"String_Node_Str"));
      Assert.assertTrue(exists(itemFull,"String_Node_Str"));
    }
 else {
      Assert.fail();
    }
  }
}