TargetValues implements Serializable { public double average() { if (list.isEmpty()) { return 0.0; } double sum = 0.0; for (TargetValue v : list) { sum += v.getValue(); } return sum / list.size(); }  int size(); Value getValue(int record); void setValue(int record, TargetValue v); void add(TargetValue v); List<TargetValue> getList(); List<TargetValue> list(); double worst(); double average();  }
@Test public void testAverageEmptyList() { TargetValues values = new TargetValues(); assertEquals(0.0, values.average(), EPSILON); }