Program: 76498
Project: 76498
Buggy source:
public void testTotalMode() throws Exception {
  IAggregation ag=BuiltInAggregationFactory.getInstance().getAggregation("String_Node_Str");
  Accumulator ac=ag.newAccumulator();
  assertEquals(BuiltInAggregationFactory.TOTAL_MODE_FUNC,ag.getName());
  assertEquals(IAggregation.SUMMARY_AGGR,ag.getType());
  assertEquals(1,ag.getParameterDefn().length);
  assertTrue(ag.getParameterDefn()[0]);
  ac.start();
  for (int i=0; i < doubleArray1.length; i++) {
    ac.onRow(new Double[]{new Double(doubleArray1[i])});
  }
  ac.finish();
  assertEquals(new Double(4.0),ac.getValue());
  ac.start();
  for (int i=0; i < doubleArray2.length; i++) {
    ac.onRow(new Double[]{new Double(doubleArray2[i])});
  }
  ac.finish();
  assertEquals(null,ac.getValue());
  ac.start();
  for (int i=0; i < str1.length; i++) {
    ac.onRow(new Object[]{str1[i]});
  }
  ac.finish();
  assertEquals(null,ac.getValue());
  ac.start();
  ac.finish();
  assertEquals(null,ac.getValue());
  ac.start();
  try {
    ac.getValue();
    assertTrue(false);
  }
 catch (  RuntimeException e) {
    assertTrue(true);
  }
  ac.start();
  ac.onRow(new Double[]{new Double(4)});
  ac.onRow(new Double[]{new Double(4)});
  ac.onRow(new Double[]{new Double(3)});
  ac.finish();
  assertEquals(ac.getValue(),new Double(4));
  ac.start();
  for (int i=0; i < dates.length; i++) {
    ac.onRow(new Object[]{dates[i]});
  }
  ac.finish();
  assertEquals(ac.getValue(),null);
  ac.start();
  for (int i=0; i < dates2.length; i++) {
    ac.onRow(new Object[]{dates2[i]});
  }
  ac.finish();
  assertEquals(ac.getValue(),new Date(2000000L));
}

Fixed version (ground truth):
public void testTotalMode() throws Exception {
  IAggregation ag=BuiltInAggregationFactory.getInstance().getAggregation("String_Node_Str");
  Accumulator ac=ag.newAccumulator();
  assertEquals(BuiltInAggregationFactory.TOTAL_MODE_FUNC,ag.getName());
  assertEquals(IAggregation.SUMMARY_AGGR,ag.getType());
  assertEquals(1,ag.getParameterDefn().length);
  assertTrue(ag.getParameterDefn()[0]);
  ac.start();
  for (int i=0; i < doubleArray1.length; i++) {
    ac.onRow(new Double[]{new Double(doubleArray1[i])});
  }
  ac.finish();
  assertEquals(new Double(4.0),ac.getValue());
  ac.start();
  for (int i=0; i < doubleArray2.length; i++) {
    ac.onRow(new Double[]{new Double(doubleArray2[i])});
  }
  ac.finish();
  assertEquals(new Double(4.0),ac.getValue());
  ac.start();
  for (int i=0; i < doubleArray4.length; i++) {
    ac.onRow(new Double[]{new Double(doubleArray4[i])});
  }
  ac.finish();
  assertEquals(null,ac.getValue());
  ac.start();
  for (int i=0; i < doubleArray5.length; i++) {
    ac.onRow(new Double[]{new Double(doubleArray5[i])});
  }
  ac.finish();
  assertEquals(new Double(1.0),ac.getValue());
  ac.start();
  for (int i=0; i < str1.length; i++) {
    ac.onRow(new Object[]{str1[i]});
  }
  ac.finish();
  assertEquals(new Double(4.0),ac.getValue());
  ac.start();
  ac.finish();
  assertEquals(null,ac.getValue());
  ac.start();
  try {
    ac.getValue();
    assertTrue(false);
  }
 catch (  RuntimeException e) {
    assertTrue(true);
  }
  ac.start();
  ac.onRow(new Double[]{new Double(4)});
  ac.onRow(new Double[]{new Double(4)});
  ac.onRow(new Double[]{new Double(3)});
  ac.finish();
  assertEquals(ac.getValue(),new Double(4));
  ac.start();
  for (int i=0; i < dates.length; i++) {
    ac.onRow(new Object[]{dates[i]});
  }
  ac.finish();
  assertEquals(ac.getValue(),null);
  ac.start();
  for (int i=0; i < dates2.length; i++) {
    ac.onRow(new Object[]{dates2[i]});
  }
  ac.finish();
  assertEquals(ac.getValue(),new Date(2000000L));
}