Program: 132425
Project: 132425
Buggy source:
public void testOverlayTree(){
  MultiOverlayTree<String,String> tree=new MultiOverlayTree<String,String>("String_Node_Str");
  tree.insert("String_Node_Str","String_Node_Str");
  tree.insert("String_Node_Str","String_Node_Str");
  tree.insert("String_Node_Str","String_Node_Str");
  int snap1=tree.newOverlay();
  tree.insert("String_Node_Str","String_Node_Str");
  tree.insert("String_Node_Str","String_Node_Str");
  tree.insert("String_Node_Str",null);
  tree.insert("String_Node_Str","String_Node_Str");
  int snap2=tree.newOverlay();
  tree.insert("String_Node_Str","String_Node_Str");
  tree.insert("String_Node_Str","String_Node_Str");
  assertNull(tree.lookup("String_Node_Str"));
  assertEquals("String_Node_Str",tree.lookup("String_Node_Str",snap1));
  assertEquals("String_Node_Str",tree.lookup("String_Node_Str"));
  assertEquals("String_Node_Str",tree.lookup("String_Node_Str",snap1));
  assertEquals("String_Node_Str",tree.lookup("String_Node_Str"));
  assertNull(tree.lookup("String_Node_Str",snap2));
  assertEquals("String_Node_Str",tree.lookup("String_Node_Str",snap1));
  assertEquals("String_Node_Str",tree.lookup("String_Node_Str",snap2));
  assertEquals("String_Node_Str",tree.lookup("String_Node_Str"));
  final int numElements=200;
  tree=new MultiOverlayTree<String,String>("String_Node_Str");
  final SortedMap<String,String> map1=new TreeMap<String,String>();
  for (int i=0x10; i < numElements; i++) {
    String key=Integer.toHexString(i);
    String val=Integer.toHexString((int)(Math.random() * Integer.MAX_VALUE));
    map1.put(key,val);
    tree.insert(key,val);
  }
  snap1=tree.newOverlay();
  final SortedMap<String,String> map2=new TreeMap<String,String>(map1);
  for (int i=0x10; i < numElements; i+=2) {
    String key=Integer.toHexString(i);
    tree.insert(key,null);
    map2.remove(key);
  }
  snap2=tree.newOverlay();
  final SortedMap<String,String> map3=new TreeMap<String,String>(map2);
  for (int i=0x10; i < numElements; i+=5) {
    String key=Integer.toHexString(i);
    String val=Integer.toHexString((int)(Math.random() * Integer.MAX_VALUE));
    tree.insert(key,val);
    map3.put(key,val);
  }
  Iterator<Entry<String,String>> it=tree.rangeLookup(null,null,false);
  Iterator<String> itExpected=map3.values().iterator();
  while (it.hasNext())   assertEquals(itExpected.next(),it.next().getValue());
  assertFalse(itExpected.hasNext());
  it=tree.rangeLookup(null,null,snap1,false);
  itExpected=map1.values().iterator();
  while (it.hasNext())   assertEquals(itExpected.next(),it.next().getValue());
  assertFalse(itExpected.hasNext());
  it=tree.rangeLookup(null,null,snap2,false);
  itExpected=map2.values().iterator();
  while (it.hasNext())   assertEquals(itExpected.next(),it.next().getValue());
  assertFalse(itExpected.hasNext());
  it=tree.rangeLookup("String_Node_Str","String_Node_Str",false);
  itExpected=map3.subMap("String_Node_Str","String_Node_Str").values().iterator();
  while (it.hasNext())   assertEquals(itExpected.next(),it.next().getValue());
  assertFalse(itExpected.hasNext());
}

Fixed version (ground truth):
public void testOverlayTree(){
  MultiOverlayTree<String,String> tree=new MultiOverlayTree<String,String>("String_Node_Str");
  tree.insert("String_Node_Str","String_Node_Str");
  tree.insert("String_Node_Str","String_Node_Str");
  tree.insert("String_Node_Str","String_Node_Str");
  int snap1=tree.newOverlay();
  tree.insert("String_Node_Str","String_Node_Str");
  tree.insert("String_Node_Str","String_Node_Str");
  tree.insert("String_Node_Str",null);
  tree.insert("String_Node_Str","String_Node_Str");
  int snap2=tree.newOverlay();
  tree.insert("String_Node_Str","String_Node_Str");
  tree.insert("String_Node_Str","String_Node_Str");
  assertEquals("String_Node_Str",tree.lookup("String_Node_Str"));
  assertEquals("String_Node_Str",tree.lookup("String_Node_Str",snap1));
  assertEquals("String_Node_Str",tree.lookup("String_Node_Str"));
  assertEquals("String_Node_Str",tree.lookup("String_Node_Str",snap1));
  assertEquals("String_Node_Str",tree.lookup("String_Node_Str"));
  assertNull(tree.lookup("String_Node_Str",snap2));
  assertEquals("String_Node_Str",tree.lookup("String_Node_Str",snap1));
  assertEquals("String_Node_Str",tree.lookup("String_Node_Str",snap2));
  assertEquals("String_Node_Str",tree.lookup("String_Node_Str"));
  final int numElements=200;
  tree=new MultiOverlayTree<String,String>("String_Node_Str");
  final SortedMap<String,String> map1=new TreeMap<String,String>();
  for (int i=0x10; i < numElements; i++) {
    String key=Integer.toHexString(i);
    String val=Integer.toHexString((int)(Math.random() * Integer.MAX_VALUE));
    map1.put(key,val);
    tree.insert(key,val);
  }
  snap1=tree.newOverlay();
  final SortedMap<String,String> map2=new TreeMap<String,String>(map1);
  for (int i=0x10; i < numElements; i+=2) {
    String key=Integer.toHexString(i);
    tree.insert(key,null);
    map2.remove(key);
  }
  snap2=tree.newOverlay();
  final SortedMap<String,String> map3=new TreeMap<String,String>(map2);
  for (int i=0x10; i < numElements; i+=5) {
    String key=Integer.toHexString(i);
    String val=Integer.toHexString((int)(Math.random() * Integer.MAX_VALUE));
    tree.insert(key,val);
    map3.put(key,val);
  }
  Iterator<Entry<String,String>> it=tree.rangeLookup(null,null,false);
  Iterator<String> itExpected=map3.values().iterator();
  while (it.hasNext())   assertEquals(itExpected.next(),it.next().getValue());
  assertFalse(itExpected.hasNext());
  it=tree.rangeLookup(null,null,snap1,false);
  itExpected=map1.values().iterator();
  while (it.hasNext())   assertEquals(itExpected.next(),it.next().getValue());
  assertFalse(itExpected.hasNext());
  it=tree.rangeLookup(null,null,snap2,false);
  itExpected=map2.values().iterator();
  while (it.hasNext())   assertEquals(itExpected.next(),it.next().getValue());
  assertFalse(itExpected.hasNext());
  it=tree.rangeLookup("String_Node_Str","String_Node_Str",false);
  itExpected=map3.subMap("String_Node_Str","String_Node_Str").values().iterator();
  while (it.hasNext())   assertEquals(itExpected.next(),it.next().getValue());
  assertFalse(itExpected.hasNext());
}