Program: 4296
Project: 4296
Buggy source:
public void testLegacy() throws Exception {
  BinaryHeap q=new BinaryHeap(4);
  MyInteger one=new MyInteger(1);
  MyInteger two=new MyInteger(2);
  MyInteger three=new MyInteger(3);
  MyInteger four=new MyInteger(4);
  MyInteger five=new MyInteger(5);
  assertTrue(q.isEmpty());
  assertEquals(4,q.capacity());
  assertEquals(0,q.size());
  q.insert(two);
  assertEquals(1,q.size());
  q.insert(three);
  q.insert(four);
  q.insert(one);
  assertTrue(q.isFull());
  assertEquals(4,q.size());
  assertEquals(four,q.getMax());
  assertEquals(four,q.extractMax());
  assertEquals(three,q.getMax());
  assertEquals(three,q.extractMax());
  q.insert(two);
  assertEquals(two,q.extractMax());
  assertEquals(two,q.extractMax());
  assertEquals(one,q.extractMax());
  try {
    q.extractMax();
    fail("String_Node_Str");
  }
 catch (  NoSuchElementException e) {
  }
  q=new BinaryHeap(2);
  assertTrue(!q.iterator().hasNext());
  q.insert(one);
  q.insert(two);
  Iterator iter=q.iterator();
  assertTrue(iter.hasNext());
  assertEquals(two,iter.next());
  assertTrue(iter.hasNext());
  assertEquals(one,iter.next());
  assertTrue(!iter.hasNext());
  try {
    iter.next();
    fail("String_Node_Str");
  }
 catch (  NoSuchElementException e) {
  }
  q=new BinaryHeap(4);
  assertNull(q.insert(one));
  assertNull(q.insert(four));
  assertNull(q.insert(three));
  assertTrue(!q.isFull());
  assertNull(q.insert(two));
  assertTrue(q.isFull());
  assertNotNull(q.insert(five));
  assertEquals(new MyInteger(2),q.insert(five));
  assertEquals(five,q.extractMax());
  assertEquals(five,q.extractMax());
  assertEquals(four,q.extractMax());
  assertEquals(three,q.extractMax());
  assertTrue(q.isEmpty());
}

Fixed version (ground truth):
public void testLegacy() throws Exception {
  BinaryHeap q=new BinaryHeap(4);
  Integer one=new Integer(1);
  Integer two=new Integer(2);
  Integer three=new Integer(3);
  Integer four=new Integer(4);
  Integer five=new Integer(5);
  assertTrue(q.isEmpty());
  assertEquals(4,q.capacity());
  assertEquals(0,q.size());
  q.insert(two);
  assertEquals(1,q.size());
  q.insert(three);
  q.insert(four);
  q.insert(one);
  assertTrue(q.isFull());
  assertEquals(4,q.size());
  assertEquals(four,q.getMax());
  assertEquals(four,q.extractMax());
  assertEquals(three,q.getMax());
  assertEquals(three,q.extractMax());
  q.insert(two);
  assertEquals(two,q.extractMax());
  assertEquals(two,q.extractMax());
  assertEquals(one,q.extractMax());
  try {
    q.extractMax();
    fail("String_Node_Str");
  }
 catch (  NoSuchElementException e) {
  }
  q=new BinaryHeap(2);
  assertTrue(!q.iterator().hasNext());
  q.insert(one);
  q.insert(two);
  Iterator iter=q.iterator();
  assertTrue(iter.hasNext());
  assertEquals(two,iter.next());
  assertTrue(iter.hasNext());
  assertEquals(one,iter.next());
  assertTrue(!iter.hasNext());
  try {
    iter.next();
    fail("String_Node_Str");
  }
 catch (  NoSuchElementException e) {
  }
  q=new BinaryHeap(4);
  assertNull(q.insert(one));
  assertNull(q.insert(four));
  assertNull(q.insert(three));
  assertTrue(!q.isFull());
  assertNull(q.insert(two));
  assertTrue(q.isFull());
  assertNotNull(q.insert(five));
  assertEquals(new Integer(2),q.insert(five));
  assertEquals(five,q.extractMax());
  assertEquals(five,q.extractMax());
  assertEquals(four,q.extractMax());
  assertEquals(three,q.extractMax());
  assertTrue(q.isEmpty());
}