Program: 75891
Project: 75891
Buggy source:
/** 
 * Tests one report design includes three libraries.
 * @throws Exception if any exception
 */
public void testLoadDesignWithThreeLibrary() throws Exception {
  openDesign("String_Node_Str");
  List libraries=designHandle.getAllLibraries();
  assertEquals(3,libraries.size());
  LibraryHandle libraryHandle1=(LibraryHandle)libraries.get(0);
  LibraryHandle libraryHandle2=(LibraryHandle)libraries.get(1);
  assertTrue(libraryHandle1.isValid());
  assertTrue(libraryHandle2.isValid());
  PropertyHandle propHandle=designHandle.getPropertyHandle(ReportDesignHandle.LIBRARIES_PROP);
  ArrayList list=propHandle.getListValue();
  assertEquals(3,list.size());
  IncludedLibrary includeLibrary=(IncludedLibrary)list.get(0);
  assertEquals("String_Node_Str",includeLibrary.getFileName());
  assertEquals("String_Node_Str",includeLibrary.getNamespace());
  includeLibrary=(IncludedLibrary)list.get(1);
  assertEquals("String_Node_Str",includeLibrary.getFileName());
  assertEquals("String_Node_Str",includeLibrary.getNamespace());
  includeLibrary=(IncludedLibrary)list.get(2);
  assertEquals("String_Node_Str",includeLibrary.getFileName());
  assertEquals("String_Node_Str",includeLibrary.getNamespace());
  assertEquals("String_Node_Str",libraryHandle2.getStringProperty(Library.AUTHOR_PROP));
  assertEquals("String_Node_Str",libraryHandle2.getStringProperty(Library.HELP_GUIDE_PROP));
  assertEquals("String_Node_Str",libraryHandle2.getStringProperty(Library.CREATED_BY_PROP));
  assertEquals("String_Node_Str",libraryHandle2.getStringProperty(Library.TITLE_ID_PROP));
  assertEquals("String_Node_Str",libraryHandle2.getStringProperty(Library.TITLE_PROP));
  assertEquals("String_Node_Str",libraryHandle2.getStringProperty(Library.COMMENTS_PROP));
  assertEquals("String_Node_Str",libraryHandle2.getStringProperty(Library.DESCRIPTION_ID_PROP));
  assertEquals("String_Node_Str",libraryHandle2.getStringProperty(Library.DESCRIPTION_PROP));
  PropertyHandle colorPalette=libraryHandle2.getPropertyHandle(Library.COLOR_PALETTE_PROP);
  List colors=colorPalette.getListValue();
  assertEquals(2,colors.size());
  CustomColor color=(CustomColor)colors.get(0);
  assertEquals("String_Node_Str",color.getName());
  assertEquals(111,color.getRGB());
  assertEquals("String_Node_Str",color.getDisplayNameID());
  assertEquals("String_Node_Str",color.getDisplayName());
  color=(CustomColor)colors.get(1);
  assertEquals("String_Node_Str",color.getName());
  assertEquals(222,color.getRGB());
  assertEquals("String_Node_Str",color.getDisplayNameID());
  PropertyHandle configVarHandle=libraryHandle2.getPropertyHandle(Library.CONFIG_VARS_PROP);
  List configVars=configVarHandle.getListValue();
  assertEquals(4,configVars.size());
  ConfigVariable var=(ConfigVariable)configVars.get(0);
  assertEquals("String_Node_Str",var.getName());
  assertEquals("String_Node_Str",var.getValue());
  var=(ConfigVariable)configVars.get(1);
  assertEquals("String_Node_Str",var.getName());
  assertEquals("String_Node_Str",var.getValue());
  var=(ConfigVariable)configVars.get(2);
  assertEquals("String_Node_Str",var.getName());
  assertEquals("String_Node_Str",var.getValue());
  var=(ConfigVariable)configVars.get(3);
  assertEquals("String_Node_Str",var.getName());
  assertEquals(null,var.getValue());
  PropertyHandle imageHandle=libraryHandle2.getPropertyHandle(Library.IMAGES_PROP);
  List images=imageHandle.getListValue();
  assertEquals(3,images.size());
  EmbeddedImage image=(EmbeddedImage)images.get(0);
  assertEquals("String_Node_Str",image.getName());
  assertEquals("String_Node_Str",image.getType(design));
  assertEquals("String_Node_Str",new String(Base64.encodeBase64(image.getData(design))).substring(0,11));
  image=(EmbeddedImage)images.get(1);
  assertEquals("String_Node_Str",image.getName());
  assertEquals("String_Node_Str",image.getType(design));
  assertEquals("String_Node_Str",new String(Base64.encodeBase64(image.getData(design))).substring(0,15));
  image=(EmbeddedImage)images.get(2);
  assertEquals("String_Node_Str",image.getName());
  assertEquals("String_Node_Str",image.getType(design));
  assertEquals("String_Node_Str",new String(Base64.encodeBase64(image.getData(design))));
}

Fixed version (ground truth):
/** 
 * Tests one report design includes three libraries.
 * @throws Exception if any exception
 */
public void testLoadDesignWithThreeLibrary() throws Exception {
  openDesign("String_Node_Str");
  List libraries=designHandle.getAllLibraries();
  assertEquals(3,libraries.size());
  LibraryHandle libraryHandle1=(LibraryHandle)libraries.get(0);
  LibraryHandle libraryHandle2=(LibraryHandle)libraries.get(1);
  assertTrue(libraryHandle1.isValid());
  assertTrue(libraryHandle2.isValid());
  PropertyHandle propHandle=designHandle.getPropertyHandle(ReportDesignHandle.LIBRARIES_PROP);
  ArrayList list=propHandle.getListValue();
  assertEquals(3,list.size());
  IncludedLibrary includeLibrary=(IncludedLibrary)list.get(0);
  assertEquals("String_Node_Str",includeLibrary.getFileName());
  assertEquals("String_Node_Str",includeLibrary.getNamespace());
  assertEquals(includeLibrary.getFileName(),libraryHandle1.getRelativeFileName());
  includeLibrary=(IncludedLibrary)list.get(1);
  assertEquals("String_Node_Str",includeLibrary.getFileName());
  assertEquals("String_Node_Str",includeLibrary.getNamespace());
  assertEquals(includeLibrary.getFileName(),libraryHandle2.getRelativeFileName());
  includeLibrary=(IncludedLibrary)list.get(2);
  assertEquals("String_Node_Str",includeLibrary.getFileName());
  assertEquals("String_Node_Str",includeLibrary.getNamespace());
  assertEquals("String_Node_Str",libraryHandle2.getStringProperty(Library.AUTHOR_PROP));
  assertEquals("String_Node_Str",libraryHandle2.getStringProperty(Library.HELP_GUIDE_PROP));
  assertEquals("String_Node_Str",libraryHandle2.getStringProperty(Library.CREATED_BY_PROP));
  assertEquals("String_Node_Str",libraryHandle2.getStringProperty(Library.TITLE_ID_PROP));
  assertEquals("String_Node_Str",libraryHandle2.getStringProperty(Library.TITLE_PROP));
  assertEquals("String_Node_Str",libraryHandle2.getStringProperty(Library.COMMENTS_PROP));
  assertEquals("String_Node_Str",libraryHandle2.getStringProperty(Library.DESCRIPTION_ID_PROP));
  assertEquals("String_Node_Str",libraryHandle2.getStringProperty(Library.DESCRIPTION_PROP));
  PropertyHandle colorPalette=libraryHandle2.getPropertyHandle(Library.COLOR_PALETTE_PROP);
  List colors=colorPalette.getListValue();
  assertEquals(2,colors.size());
  CustomColor color=(CustomColor)colors.get(0);
  assertEquals("String_Node_Str",color.getName());
  assertEquals(111,color.getRGB());
  assertEquals("String_Node_Str",color.getDisplayNameID());
  assertEquals("String_Node_Str",color.getDisplayName());
  color=(CustomColor)colors.get(1);
  assertEquals("String_Node_Str",color.getName());
  assertEquals(222,color.getRGB());
  assertEquals("String_Node_Str",color.getDisplayNameID());
  PropertyHandle configVarHandle=libraryHandle2.getPropertyHandle(Library.CONFIG_VARS_PROP);
  List configVars=configVarHandle.getListValue();
  assertEquals(4,configVars.size());
  ConfigVariable var=(ConfigVariable)configVars.get(0);
  assertEquals("String_Node_Str",var.getName());
  assertEquals("String_Node_Str",var.getValue());
  var=(ConfigVariable)configVars.get(1);
  assertEquals("String_Node_Str",var.getName());
  assertEquals("String_Node_Str",var.getValue());
  var=(ConfigVariable)configVars.get(2);
  assertEquals("String_Node_Str",var.getName());
  assertEquals("String_Node_Str",var.getValue());
  var=(ConfigVariable)configVars.get(3);
  assertEquals("String_Node_Str",var.getName());
  assertEquals(null,var.getValue());
  PropertyHandle imageHandle=libraryHandle2.getPropertyHandle(Library.IMAGES_PROP);
  List images=imageHandle.getListValue();
  assertEquals(3,images.size());
  EmbeddedImage image=(EmbeddedImage)images.get(0);
  assertEquals("String_Node_Str",image.getName());
  assertEquals("String_Node_Str",image.getType(design));
  assertEquals("String_Node_Str",new String(Base64.encodeBase64(image.getData(design))).substring(0,11));
  image=(EmbeddedImage)images.get(1);
  assertEquals("String_Node_Str",image.getName());
  assertEquals("String_Node_Str",image.getType(design));
  assertEquals("String_Node_Str",new String(Base64.encodeBase64(image.getData(design))).substring(0,15));
  image=(EmbeddedImage)images.get(2);
  assertEquals("String_Node_Str",image.getName());
  assertEquals("String_Node_Str",image.getType(design));
  assertEquals("String_Node_Str",new String(Base64.encodeBase64(image.getData(design))));
}