Program: 74659
Project: 74659
Buggy source:
/** 
 * Test cases: <p> 1. remove/add themes in the library and see effects to the library.
 * @throws Exception
 */
public void testAddRemoveThemeLocally() throws Exception {
  openLibrary("String_Node_Str");
  assertNotNull(libraryHandle.getTheme());
  StyleHandle libStyle1=libraryHandle.findStyle("String_Node_Str");
  libStyle1.drop();
  libraryHandle.getCommandStack().undo();
  LabelHandle label3=(LabelHandle)libraryHandle.findElement("String_Node_Str");
  assertEquals("String_Node_Str",label3.getStringProperty(Style.COLOR_PROP));
  ThemeHandle theme1=libraryHandle.findTheme("String_Node_Str");
  assertNotNull(theme1);
  TextItemHandle text1=(TextItemHandle)libraryHandle.findElement("String_Node_Str");
  LabelHandle label1=(LabelHandle)libraryHandle.findElement("String_Node_Str");
  LabelHandle label2=(LabelHandle)libraryHandle.findElement("String_Node_Str");
  assertEquals(ColorPropertyType.BLACK,text1.getProperty(Style.COLOR_PROP));
  assertEquals(ColorPropertyType.RED,label1.getProperty(Style.COLOR_PROP));
  assertEquals(ColorPropertyType.RED,label2.getProperty(Style.COLOR_PROP));
  libraryHandle.getThemes().drop(theme1);
  assertEquals(ColorPropertyType.BLACK,text1.getProperty(Style.COLOR_PROP));
  assertEquals(ColorPropertyType.BLACK,label1.getProperty(Style.COLOR_PROP));
  assertEquals(ColorPropertyType.BLACK,label2.getProperty(Style.COLOR_PROP));
  libraryHandle.getCommandStack().undo();
  assertEquals(ColorPropertyType.RED,label1.getProperty(Style.COLOR_PROP));
  libraryHandle.getCommandStack().redo();
  assertEquals(ColorPropertyType.BLACK,label1.getProperty(Style.COLOR_PROP));
}

Fixed version (ground truth):
/** 
 * Test cases: <p> 1. remove/add themes in the library and see effects to the library.
 * @throws Exception
 */
public void testAddRemoveThemeLocally() throws Exception {
  openLibrary("String_Node_Str");
  assertNotNull(libraryHandle.getTheme());
  StyleHandle libStyle1=libraryHandle.findStyle("String_Node_Str");
  libStyle1.drop();
  libraryHandle.getCommandStack().undo();
  LabelHandle label3=(LabelHandle)libraryHandle.findElement("String_Node_Str");
  assertEquals("String_Node_Str",label3.getStringProperty(Style.COLOR_PROP));
  ThemeHandle theme1=libraryHandle.findTheme("String_Node_Str");
  assertNotNull(theme1);
  TextItemHandle text1=(TextItemHandle)libraryHandle.findElement("String_Node_Str");
  LabelHandle label1=(LabelHandle)libraryHandle.findElement("String_Node_Str");
  LabelHandle label2=(LabelHandle)libraryHandle.findElement("String_Node_Str");
  assertEquals(ColorPropertyType.BLACK,text1.getProperty(Style.COLOR_PROP));
  assertEquals(ColorPropertyType.RED,label1.getProperty(Style.COLOR_PROP));
  assertEquals(ColorPropertyType.RED,label2.getProperty(Style.COLOR_PROP));
  libraryHandle.getThemes().drop(theme1);
  assertEquals(ColorPropertyType.BLACK,text1.getProperty(Style.COLOR_PROP));
  assertEquals(ColorPropertyType.BLACK,label1.getProperty(Style.COLOR_PROP));
  assertEquals(ColorPropertyType.BLACK,label2.getProperty(Style.COLOR_PROP));
  assertNotNull(label3.getProperty(IStyledElementModel.STYLE_PROP));
  libraryHandle.getCommandStack().undo();
  assertEquals(ColorPropertyType.RED,label1.getProperty(Style.COLOR_PROP));
  libraryHandle.getCommandStack().redo();
  assertEquals(ColorPropertyType.BLACK,label1.getProperty(Style.COLOR_PROP));
  libraryHandle.getCommandStack().undo();
  libraryHandle.getThemes().dropAndClear(theme1);
  assertNull(label3.getProperty(IStyledElementModel.STYLE_PROP));
}