Program: 32827
Project: 32827
Buggy source:
/** 
 * Test if the SortedList fires update events rather than delete/insert pairs, when using a ReverseComparator. <p>The source list uses a totally different comparator than the sorted list in order to guarantee the indicies have no pattern.
 */
public void testUpdateEventsFiredRigorous(){
  Comparator uniqueComparator=new ReverseStringComparator();
  UniqueList uniqueSource=new UniqueList(unsortedList,uniqueComparator);
  sortedList=new SortedList(uniqueSource);
  for (int i=0; i < 500; i++) {
    uniqueSource.add(new Integer(random.nextInt(200)));
  }
  SortedSet data=new TreeSet(uniqueComparator);
  for (int i=0; i < 500; i++) {
    data.add(new Integer(random.nextInt(200)));
  }
  List intersection=new ArrayList();
  intersection.addAll(uniqueSource);
  intersection.retainAll(data);
  int expectedUpdateCount=intersection.size();
  int expectedDeleteCount=uniqueSource.size() - expectedUpdateCount;
  int expectedInsertCount=data.size() - expectedUpdateCount;
  int expectedChangeCount=expectedUpdateCount + expectedDeleteCount + expectedInsertCount;
  ListEventCounter uniqueCounter=new ListEventCounter();
  uniqueSource.addListEventListener(uniqueCounter);
  ListEventCounter sortedCounter=new ListEventCounter();
  sortedList.addListEventListener(sortedCounter);
  uniqueSource.addListEventListener(new ConsistencyTestList(uniqueSource,"String_Node_Str",true));
  sortedList.addListEventListener(new ConsistencyTestList(sortedList,"String_Node_Str",true));
  uniqueSource.replaceAll(data);
  assertEquals(1,uniqueCounter.getEventCount());
  assertEquals(1,sortedCounter.getEventCount());
  assertEquals(expectedChangeCount,uniqueCounter.getChangeCount(0));
  assertEquals(expectedChangeCount,sortedCounter.getChangeCount(0));
}

Fixed version (ground truth):
/** 
 * Test if the SortedList fires update events rather than delete/insert pairs, when using a ReverseComparator. <p>The source list uses a totally different comparator than the sorted list in order to guarantee the indicies have no pattern.
 */
public void testUpdateEventsFiredRigorous(){
  Comparator uniqueComparator=new ReverseStringComparator();
  UniqueList uniqueSource=new UniqueList(unsortedList,uniqueComparator);
  sortedList=new SortedList(uniqueSource);
  for (int i=0; i < 500; i++) {
    uniqueSource.add("String_Node_Str" + random.nextInt(200));
  }
  SortedSet data=new TreeSet(uniqueComparator);
  for (int i=0; i < 500; i++) {
    data.add("String_Node_Str" + random.nextInt(200));
  }
  List intersection=new ArrayList();
  intersection.addAll(uniqueSource);
  intersection.retainAll(data);
  int expectedUpdateCount=intersection.size();
  int expectedDeleteCount=uniqueSource.size() - expectedUpdateCount;
  int expectedInsertCount=data.size() - expectedUpdateCount;
  int expectedChangeCount=expectedUpdateCount + expectedDeleteCount + expectedInsertCount;
  ListEventCounter uniqueCounter=new ListEventCounter();
  uniqueSource.addListEventListener(uniqueCounter);
  ListEventCounter sortedCounter=new ListEventCounter();
  sortedList.addListEventListener(sortedCounter);
  uniqueSource.addListEventListener(new ConsistencyTestList(uniqueSource,"String_Node_Str",true));
  sortedList.addListEventListener(new ConsistencyTestList(sortedList,"String_Node_Str",true));
  uniqueSource.replaceAll(data);
  assertEquals(1,uniqueCounter.getEventCount());
  assertEquals(1,sortedCounter.getEventCount());
  assertEquals(expectedChangeCount,uniqueCounter.getChangeCount(0));
  assertEquals(expectedChangeCount,sortedCounter.getChangeCount(0));
}